aboutsummaryrefslogtreecommitdiff
path: root/cmd
AgeCommit message (Collapse)Author
2026-02-11cmd/httpdfs: add option to set base path and shutdown idle durationShulhan
The `-base-path` option set the URL prefix for serving HTTP request. The `-shutdown-idle` option set the duration when server will stop accepting new connections and shutting down.
2026-02-05cmd/httpdfs: fix call to log.FatalShulhan
2026-02-02cmd/httpdfs: implement systemd socket activationShulhan
The httpdfs program now can be activated using systemd.socket(5).
2026-01-03all: use SPDX license header formatShulhan
2025-01-26lib/goanalysis: package to complement "go vet"Shulhan
Package goanalysis implement go static analysis using [Analyzer] that are not included in the default "go vet", but included in the [passes] directory, including: fieldalignment, nilness, reflectvaluecompare, shadow, sortslice, unusedwrite, and waitgroup. This package is not mean to be imported directly by other package except main, like we have in [cmd/gocheck]. The rest (and previous) of the changes are affect running gocheck on it.
2024-12-29cmd/ansua: add and update documentationShulhan
2024-09-30all: simplify some statementsShulhan
2024-09-04all: fix various linter warningsShulhan
While at it, temporary disable gosec due to excessive report for G115, which may be true, but may also break the current working program. We should alter and fix once we can test and make sure that it does not breaks.
2024-08-04cmd/emaildecode: CLI to decode email body to plain textShulhan
The emaildecode accept file as input. If the email header contains content-transfer-encoding with value quoted-printable or base64, it will decode the message body and print it to stdout as plain text.
2024-07-22cmd/bcrypt: check for error during FscanlnShulhan
2024-04-03cmd/httpdfs: set default include options to emptyShulhan
By default httpdfs now serve all files under base directory.
2024-04-03cmd/ansua: command line interface to help tracking timeShulhan
Usage, ansua <duration> [ "<command>" ] ansua execute a timer on defined duration and optionally run a command when timer finished. When ansua timer is running, one can pause the timer by pressing p+Enter, and resume it by pressing r+Enter, or stopping it using CTRL+c.
2024-03-09lib/http: refactoring NewServer and NewClientShulhan
The NewServer and NewClient now accept non-pointer options, so the caller unable to modify the options once the server or client has been created.
2024-03-09all: reformat all files with goimportsShulhan
2024-03-05all: comply with linter recommendations #1Shulhan
Instead of annotating the lines that caught by linters, fix it to comply with the recommendations. This causes several breaking changes, especially related to naming, * api/slack: [Message.IconUrl] become [Message.IconURL] * lib/dns: DefaultSoaMinumumTtl become DefaultSoaMinimumTTL * lib/email: [Message.SetBodyHtml] become [Message.SetBodyHTML] * lib/http: [Client.GenerateHttpRequest] become [Client.GenerateHTTPRequest] * lib/http: [ClientOptions.ServerUrl] become [ClientOptions.ServerURL] * lib/http: [EndpointRequest.HttpWriter] become [EndpointRequest.HTTPWriter] * lib/http: [EndpointRequest.HttpRequest] become [EndpointRequest.HTTPRequest] * lib/http: [ServerOptions.EnableIndexHtml] become [ServerOptions.EnableIndexHTML] * lib/http: [SSEConn.HttpRequest] become [SSEConn.HTTPRequest] * lib/smtp: [ClientOptions.ServerUrl] become [ClientOptions.ServerURL] * lib/ssh/sftp: [FileAttrs.SetUid] become [FileAttrs.SetUID] * lib/ssh/sftp: [FileAttrs.Uid] become [FileAttrs.UID]
2024-03-02all: move the repository to "git.sr.ht/~shulhan/pakakeh.go"Shulhan
There are several reasons that why we move from github.com. First, related to the name of package. We accidentally name the package with "share" a common word in English that does not reflect the content of repository. By moving to other repository, we can rename it to better and unique name, in this "pakakeh.go". Pakakeh is Minang word for tools, and ".go" suffix indicate that the repository related to Go programming language. Second, supporting open source. The new repository is hosted under sourcehut.org, the founder is known to support open source, and all their services are licensed under AGPL, unlike GitHub that are closed sources. Third, regarding GitHub CoPilot. The GitHub Terms of Service [1], allow any public content that are hosted there granted them to parse the content. On one side, GitHub helps and flourish the open source, but on another side have an issues regarding scraping the copyleft license [2]. [1]: https://docs.github.com/en/site-policy/github-terms/github-terms-of-service#4-license-grant-to-us [2]: https://githubcopilotinvestigation.com
2023-12-13all: fix linter warnings reported by reviveShulhan
There are some reports that I disagree with revive, in example, code should not declare the type after variables. In my opinion, on some cases, declaring the type make the code more readable and explicit. Since I did not want to add new configuration file, we changes it and follow revive for now.
2023-12-12cmd/httpdfs: implement [libhttp.Server] with [memfs.MemFS]Shulhan
The httpdfs accept single directory to be served under HTTP server, with the following options, -address <IP:PORT> Run the HTTP server on specific IP address and port. Default to ` + defAddress + `. -exclude <regex> Exclude the files matched by regex from being served. Default to empty, none of files is excluded. -help Print this usage. -include <regex> Serve only list of files matched with regex. Default to include CSS, HTML, JavaScript, ICO, JPG, PNG, and SVG files only. -version Print the program version.
2023-09-11cmd/smtpcli: realign the struct clientShulhan
This reduce the client size from 56 to 40 bytes (-16).
2023-09-11cmd/bcrypt: add missing package commentShulhan
2023-06-04all: update description of some command and in READMEShulhan
Mention that some of the commands are example of implementation of the library.
2023-05-20all: remove any usage of debug.Value in all packagesShulhan
Using global debug value for all packages turns out is not a good idea.
2023-05-05cmd/bcrypt: CLI to compare or generate hash using bcryptShulhan
2023-02-25cmd: temporarily hide unused commandsShulhan
The cart, cascaded-random-forest, lnsmote, random-forest, and smote are part of completing thesis and they never used anymore.
2022-07-27cmd/gofmtcomment: add command "help" and "version"Shulhan
While at it, expand the usage to describe the synopsis, arguments, and example of command. Also, replace any variable assignment from ":=" to explicit variable with type.
2022-07-27cmd/xtrk: add command "help" and "version"Shulhan
2022-07-27cmd/epoch: print the weekday in local and UTC timeShulhan
2022-07-27cmd/epoch: add flag to parse time from RFC3339 and RFC1123 formatShulhan
The flag for RFC1123 comes with two options one with string timezone (-rfc1123) and one with numeric time zone (-rfc1123z).
2022-07-27cmd/epoch: add command "help" and "version"Shulhan
2022-07-27cmd/ini: a CLI to get and set values in the INI file formatShulhan
This is the CLI that implements the lib/ini for getting and setting the key's value from INI file.
2022-05-09all: reformat all codes using gofmt 1.19 (the Go tip)Shulhan
2022-04-06all: replace any usage of ioutil package with os or ioShulhan
Since Go 1.16, the ioutil package has been deprecated. This changes replace any usage that use functions from ioutil package with their replacement from package os or package io.
2022-02-28cmd/sendemail: command line interface to send an emailShulhan
The sendemail command is proof of concept on how to use lib/email and lib/smtp to write and send email through SMTP.
2022-02-18lib/smtp: refactoring NewClient to use struct instead of parametersShulhan
Previously, to create new client one must pass three parameters to NewClient function: localName, remoteURL, and insecure. If we want to add another parameters in the future, it will cause the function signature changes. This changes simplify creating NewClient by passing single struct with new parameters: AuthUser, AuthPass, and AuthMechanism. If both AuthUser and AuthPass is not empty, the NewClient will authenticate the connection, minimize number of step on the caller.
2022-02-06cmd/xtrk: command line interface to uncompress and/or unarchive fileShulhan
xtrk accept single file to uncompress and/or archived into a directory output dir". If directory output "dir" is not defined, it will be set to current directoy. The compression and archive format is detected automatically based on the following file input extension: * .bz2: decompress using bzip2. * .gz: decompress using gzip. * .tar: unarchive using tar. * .zip: unarchive using zip. * .tar.bz2: decompress using bzip2 and unarchive using tar. * .tar.gz: decompresss using gzip and unarchive using tar. The input file will be removed on success.
2022-01-09cmd/gofilemode: new command to decode the Go file modeShulhan
The Go has their own file mode that works across all operating system. The file mode is represented by uint64, the command line will convert it to fs.FileMode and print each possible flag on it including the permission. http://127.0.0.1:6060/pkg/io/fs/#FileMode
2021-12-19cmd/epoch: command line to print and parse Unix timestampShulhan
Program epoch print the current time (Unix seconds, milliseconds, nanoseconds, local time, and UTC time) or the time based on the epoch on first parameter. Usage, epoch <unix-seconds|unix-milliseconds|unix-nanoseconds> Without a parameter, it will print the current time. With single parameter, it will print the time based on that epoch.
2021-10-25lib/totp: make the New to accept only hash with SHA1, SHA256, or SHA512Shulhan
Previously, the first parameter to New is a function that return hash.Hash. This signature can be misleading, because md5.New also can return hash.Hash but not usable in TOTP. This changes update the New function signature to accept defined type that can be set to SHA1, SHA256, or SHA512.
2020-12-23totp: add method to generate n number of passwordsShulhan
The GenerateN method will return list of password from (current time - N*timeStep) until the current time.
2020-12-23cmd: add new CLI "totp"Shulhan
The totp is a program to generate Time-based One-time Password from secret key.
2020-06-10all: update email addressShulhan
2020-06-06all: use default linter optionsShulhan
2019-11-15lib/mining: move commands to rootShulhan
2019-06-14all: fix nolint formatShulhan
The valid syntax to suppress linter warnings is "//nolint:<name>" with no space between comment and "nolint" and between ":". Also, we move the placement of nolint directive to the top of statements for multiple nolint in the same scope. While at it, fix and supress some linter warnings.
2019-04-02cmd/smtpcli: command line interface to SMTP client protocolShulhan
The smtpcli provide five internal command to interact with server: "starttls", "from", "to", "data", and "quit".
2019-03-01all: fix warnings from linterShulhan
Most of the warnings caused by update to linter which cause global variables declared with grouping "( ... )" and that has been suppressed, are become false-positive again.
2018-11-30all: minimize and suppress linter warnings for global variablesShulhan
2018-11-29all: fix warnings from lintersShulhan
2018-05-12Add copyright and license informationShulhan
2018-03-31Add command line program to convert "/**/" comment into "//"Shulhan