Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:

Marek ‘saji’ Augustynowicz marek-saji

:shipit:
View GitHub Profile
@marek-saji
marek-saji / link.sh
Created May 4, 2022
Script for linking dotfiles using stow(8)
View link.sh
View gist:0aadd13d80ee7327f6dbd2ff9b3767a1
I am attesting that this GitHub handle marek-saji is linked to the Tezos account tz1d3J15MX3hWjEkT447G1Lzdrh7hqXmQRbU for tzprofiles
sig:edsigu5Dhfptkbx2Zr1dzt12WySVUYbEfBXuQyFsFK7PJNJ7xkYpX4Q2CcDf84xgHdsBqUCkgFDuifzsbkmfwvfvy2JYgGQajeH
@marek-saji
marek-saji / .bashrc
Last active Oct 1, 2020
df across hosts
View .bashrc
MY_HOSTS="list of hosts I own"
_dff ()
{
local df
df="$(
TAIL=+1
{
echo /
echo /tmp
View git-daily
#!/bin/sh
#
# Display a summary of what you’ve been working on since yesterday
# Copyright 2020 Marek Augustynowicz
# Licensed under ISC license <https://opensource.org/licenses/ISC>
#
# https://gist.github.com/marek-saji/fd107bbd01d5436ca751effec335dae4
# GistID: fd107bbd01d5436ca751effec335dae4
set -e
View git-daily
#!/bin/sh
#
# Display a summary of what you’ve been working on since yesterday
#
set -e
HEADER_FORMAT="\n\033[34m# %s\033[0m\n"
GIT_LOG_FORMAT="$( git config --get pretty.me --default="%C(green)(%cd) %C(reset)%s%C(yellow)%d %C(red)%h%C(reset)" )"
View tree-stderr.sh
#!/bin/sh
foo ()
{
echo stdout
echo stderr 1>&2
return 1
}
{
View foo.php
<?php
ini_set('display_errors', true);
for ($i = 1; $i <= 4; $i += 1)
{
echo 'out', $i, PHP_EOL;
if ($stderr = fopen('php://stderr', 'a'))
{
fprintf($stderr, "err{$i}\n");
}
}
View fib2.sh
#!/bin/sh
# GistID: 119ae9d2166958f931b619776f835898
set -e
minus2=
minus1=
for i in $( seq 0 $(( $1 - 1 )) )
do
if [ -z "$minus2" ] || [ -z "$minus1" ]
then
View rmv.sh
rmv ()
{
if [ "$#" -lt 2 ]; then
echo "Usage: rmv [RSYNC_OPTIONS] SOURCE... TARGET";
return 64;
fi;
local argv=("$@");
local target="${argv[${#argv[@]}-1]}";
unset "argv[${#argv[@]}-1]";
[ -e "${target}" ] || mkdir -p "${target}";
View random-emoji.sh
EMOJI_JSON="$( curl -s https://raw.githubusercontent.com/iamcal/emoji-data/master/emoji.json )"
RANDOM_EMOJI_DATA="$(
echo "${EMOJI_JSON}" |
jq -r '.[] | (.unified + "\t" + .short_name )' |
sort -R --random-source=<( for I in $( seq 1 1000 ); do echo "$SEED$I" | sha1sum; done ) |
head -n1 |
sed -r 's/^|-/\\U/g'
)"
RANDOM_EMOJI="$( echo -e "${RANDOM_EMOJI_DATA}" | cut -f1 )"
RANDOM_EMOJI_NAME="$( echo -e "${RANDOM_EMOJI_DATA}" | cut -f2 )"