Skip to content

Instantly share code, notes, and snippets.

@stokito
stokito / README.md
Last active November 23, 2025 17:27
CGI shell scripts samples

CGI samples

CGI Variables

Standard set of Common Gateway Interface environment variable are described in RFC3875. For example:

CONTENT_TYPE=application/x-www-form-urlencoded
GATEWAY_INTERFACE=CGI/1.1
REMOTE_ADDR=192.168.1.180
QUERY_STRING=Zbr=1234567&SrceMB=&ime=jhkjhlkh+klhlkjhlk+%A9%D0%C6%AE%C6%AE&prezime=&sektor=OP
REMOTE_PORT=2292
@bashbunni
bashbunni / .zshrc
Last active January 21, 2026 01:41
CLI Pomodoro for Mac
# I'll be doing another one for Linux, but this one will give you
# a pop up notification and sound alert (using the built-in sounds for macOS)
# Requires https://github.com/caarlos0/timer to be installed
# Mac setup for pomo
alias work="timer 60m && terminal-notifier -message 'Pomodoro'\
-title 'Work Timer is up! Take a Break 😊'\
-appIcon '~/Pictures/pumpkin.png'\
-sound Crystal"
@koakh
koakh / gist:fbbc37cde630bedcf57acfd4d6a6956b
Last active March 24, 2025 14:40
SurrealDB : How to use signin and signup (server + client nodesjs)
**As a developer you have complete control over the signup and signin functionality...**
```shell
$ surreal sql --conn http://localhost:8000 --user root --pass root --ns test --db test
```
```sql
-- optional : this is the default see --ns test --db test start server flags
-- USE NS test DB test;
@heyfluke
heyfluke / remap_docker_user_to_host_user.md
Last active January 20, 2026 15:52
remap docker user to host user.

Problem

When I use docker to work with the shared workspace with host under Ubuntu, I find that files created by docker user is owned by root. This is not the same with macOS.

Maybe this is becuase docker is run by root user and the default user mapping mechanism is to map container-root to host-user or host-root. So can I map the container-root or container-any-user to host-current-user?

Fortunately the latest docker supports the re-map the container user to any host user via Linux namespace. Refer to this.

Linux namespace

@Ocramius
Ocramius / Caddyfile
Last active March 11, 2024 22:14
Example docker + docker-compose + caddy + traefik setup that routes to multiple apps from one exposed HTTP port
:80 {
root /serve
}
@guiniol
guiniol / aliases.muttrc
Last active October 27, 2024 09:44
neomutt configuration with notmuch
alias YOU YOUR NAME <email@somewhere.com>
@kun-zhou
kun-zhou / calRemind.sh
Last active June 16, 2025 06:26
This script is used to fetch calendar entries from `khal` and set up reminders through `notify-send` 10 minutes ahead using `at` utility. It is supposed to be executed whenever your calendar update. If you use `vdirsyncer`, probably you would want run this script after running `vdirsyncer sync`
#!/usr/bin/bash
# The line below extracts the events in each line and add quotes to them so for loop will loop through each of them
items=`khal list today|tail -n +2 #no longer needed|awk -F"\n" '{printf("\"%s\"\n"),$1}'`
echo "$items"|while read -r rem # I pipe the list because otherwise the loop will treat blank space as delimiter
do
rm_time=$(($(date +%s --date "`echo $rem | sed -n 's/^\([0-9][0-9]:[0-9][0-9]\)-.*/\1:00/p'`") - 600)) # this command extracts the starting time of the event, and convert it to EPOCH, and subtract 10 minutes from it.
rm_time=`date +%H:%M --date @$rm_time` # This converts EPOCH back to human readble form
rem_name=`echo $rem | sed -n 's/.*:[0-9][0-9] \(.*\)/\1/p'`
echo "notify-send 'Calendar Reminder: $rem_name'" | at $rm_time today
done
@gagarine
gagarine / install-clamav-osx.md
Last active December 6, 2025 16:05
Howto Install clamav on OSX with brew

Howto Install clamav on OSX with brew

Note: on legacy intel system the path may be /usr/local/etc/clamav instead of /opt/homebrew/etc/clamav/

$ brew install clamav
$ cd /opt/homebrew/etc/clamav/
$ cp freshclam.conf.sample freshclam.conf
@danieleggert
danieleggert / GPG and git on macOS.md
Last active January 15, 2026 20:31
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@thbar
thbar / how-to-diff-pdf-files-with-git-and-diffpdf.md
Last active January 2, 2026 17:02
How to diff PDF files with Git

One can use MD5 or plain text diff to see differences in PDF files. If that's not enough, here's how to use diff-pdf which knows how to diff based on appearance or words:

  • brew install diff-pdf
  • edit your ~/.gitconfig to add this:
[difftool "diffpdf"]
  cmd = diff-pdf --view \"$LOCAL\" \"$REMOTE\"