Skip to content

Instantly share code, notes, and snippets.

View alganet's full-sized avatar

Alexandre Gomes Gaigalas alganet

View GitHub Profile
@alganet
alganet / idiom.sh
Created August 19, 2022 10:41
Portable shell script cargo typing and runtime expression parsing experiment
set -euf
PATH=
IFS=
_r=
_v=0 # variable counter
_f=1 # scopedion namespace
_x=0 # parser namespace
! command -v emulate >/dev/null 2>&1 || emulate ksh >/dev/null 2>&1
@alganet
alganet / djb2.sh
Created August 19, 2022 10:24
djb2 hash implementation in portable shell
set -euf
IFS=''
LC_ALL=C
! command -v emulate >/dev/null 2>&1 || emulate ksh >/dev/null 2>&1
command -v local >/dev/null 2>&1 || alias local=typeset
_ordchr_='\015\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\'
_ordchr_="$(printf "$_ordchr_")"
@alganet
alganet / make.partial.log
Created March 8, 2021 22:46
make partial log
/bin/bash php-src/libtool --silent --preserve-dup-deps --mode=compile gcc -Iext/hash/ -Iphp-src/ext/hash/ -Iphp-src/include -Iphp-src/main -Iphp-src -Iphp-src/ext/date/lib -Iphp-src/TSRM -Iphp-src/Zend -Wall -Wextra -Wno-strict-aliasing -Wno-implicit-fallthrough -Wno-unused-parameter -Wno-sign-compare -Wextra -std=c99 -static -fno-pie -no-pie -mno-red-zone -nostdlib -nostdinc -fno-omit-frame-pointer -pg -mnop-mcount -I./include -include ./cosmopolitan/cosmopolitan.h -fvisibility=hidden -Iphp-src/ext/hash/sha3/generic64lc -DKeccakP200_excluded -DKeccakP400_excluded -DKeccakP800_excluded -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Iphp-src/ext/hash/xxhash -c php-src/ext/hash/hash_xxhash.c -o ext/hash/hash_xxhash.lo -MMD -MF ext/hash/hash_xxhash.dep -MT ext/hash/hash_xxhash.lo
In file included from php-src/Zend/zend_config.h:1,
from php-src/Zend/zend_portability.h:43,
from php-src/Zend/zend_types.h:25,
from php-src/Zend/zend.h:27,
from php-src/m
0:00:17.080,0:00:21.220
So I'm Will, and
I was a
0:00:21.220,0:00:24.460
middleschool teacher,
and I ran a summercamp
0:00:24.460,0:00:27.840
and I did all these things.
@alganet
alganet / hours.sh
Created February 7, 2020 21:00
hours.sh
#!/usr/bin/env bash
calculate_debt_hours_per_day () {
total_debt="${1:-}"
hours_debt="${1%:*}"
minutes_debt="${1#*:}"
payment_days="${2:-}"
if test -z "$hours_debt"
then
@alganet
alganet / hers.sh
Last active February 16, 2026 05:43
Fast and portable mouse/keyboard terminal capture (zsh,ksh,mksh,bash on Windows+WSL, Linux or Mac OS)
#!/bin/sh
# Quick run: bash -c "$(curl -L https://git.io/fjToH)"
# CTRL+W to exit
set -euf
unsetopt FLOW_CONTROL GLOB NO_MATCH NO_SH_WORD_SPLIT NO_PROMPT_SUBST 2>/dev/null || :
write ()
{
#!/bin/sh
# Before
set 1 2 3 4 5
while test $# -gt 0;do
echo $1
shift
done
@alganet
alganet / jenkins.css
Created December 6, 2017 00:16
Jenkins Pipeline CSS
revision .description {
overflow: hidden;
}
div.pipeline-wrapper div.pipeline-info {
max-width: 116px;
}
@alganet
alganet / carreira_y_brasil.md
Created February 5, 2017 02:26
O Problema da Carreira em Y pra TI no Brasil

O Problema da Carreira em Y pra TI no Brasil

Não existe carreira em Y pra TI no Brasil.

Fim.

@alganet
alganet / calc.sh
Created January 8, 2017 03:44
Prefix-notation calculator in portable shell
calc ()
{
local cursor=0
local reference=0
local stack=0
local queue=''
local current=''
set -- $(echo ${@})