Skip to content

Instantly share code, notes, and snippets.

View ak2766's full-sized avatar

Anthony Kamau ak2766

View GitHub Profile
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@ak2766
ak2766 / ANSI.md
Created December 23, 2021 00:07 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@ak2766
ak2766 / vmrc_attach.sh
Created October 10, 2021 04:38 — forked from rgerganov/vmrc_attach.sh
Virtual USB Drive
#!/usr/bin/env sh
if [ "$#" -ne 5 ]; then
echo "Usage: $0 <host> <user> <pwd> <vm-id> <dev-id>"
exit 1
fi
echo "attach $1 $2 $3 $4 $5" | nc localhost 9999
@ak2766
ak2766 / haproxy.cfg
Created July 28, 2020 17:24 — forked from daemonza/haproxy.cfg
HAproxy virtual site load balancing
# This configuration use acl's to distinguish between url's passwd and then route
# them to the right backend servers. For the backend servers to handle it correctly, you
# need to setup virtual hosting there as well, on whatever you use, tomcat, nginx, apache, etc.
# For this to work with SSL, put pound before HAproxy and use a configuration file similar to
# https://gist.github.com/1984822 to get it working
global
log 127.0.0.1 local0
log 127.0.0.1 local1 info
maxconn 4096
void main() {
print(getTimeInISO8601());
}
String getTimeInISO8601() {
var ct = DateTime.now().toUtc();
String year = ct.year.toString().padLeft(4,'0');
String month = ct.month.toString().padLeft(2,'0');
String day = ct.day.toString().padLeft(2,'0');
String hour = ct.hour.toString().padLeft(2,'0');
@ak2766
ak2766 / signtool.msbuild.tasks
Created October 17, 2019 12:01 — forked from gregmac/signtool.msbuild.tasks
SignTool MSBuild Task
<!--
Sign .exe files using signtool.exe.
(c) 2014 Greg MacLellan, Licensed under MIT http://opensource.org/licenses/MIT
Features:
* Hides password from being displayed in build output
* Retries against multiple timestamp servers if the server returns an invalid response (fairly common)
Usage: