This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# GistID: 119ae9d2166958f931b619776f835898 | |
set -e | |
minus2= | |
minus1= | |
for i in $( seq 0 $(( $1 - 1 )) ) | |
do | |
if [ -z "$minus2" ] || [ -z "$minus1" ] | |
then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 )" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SVG_PATH:=../og-emoji-font/svgs | |
SVG_FILES:=$(wildcard $(SVG_PATH)/*.svg) | |
PNG_FILES:=$(addsuffix .png, $(basename $(SVG_FILES))) | |
all: $(PNG_FILES) | |
%.png: $(SVG_PATH)/%.svg | |
rsvg-convert --width=128 --height=128 $< --output=$@ | |
clean: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$array1 = array( | |
array('A', 1), | |
array('B', 1), | |
); | |
$array2 = array( | |
array('A', 2), | |
array('C', 2), | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# GistID: 5c5d5c1955da30ac592cab10cabf253d | |
set -e | |
LOCATION_FILE="$HOME/.config/photo-locations.csv" | |
print_help () | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
local argv=( "$@" ) | |
local target="${argv[${#argv[@]}-1]}" | |
unset "argv[${#argv[@]}-1]" | |
rsync --remove-source-files -PaX "${argv[@]}" "${target}/" \ | |
&& find "${argv[@]}" -empty -type d -delete |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "$2" = "template" ] || [ "$2" = "commit" ] | |
then | |
STAT="$( command git diff --cached --shortstat )" | |
if [ -n "${STAT}" ] | |
then | |
INS="$( echo "${STAT}" | grep -Eo '[0-9]+ insertion' | grep -o '[0-9]*' )" | |
DEL="$( echo "${STAT}" | grep -Eo '[0-9]+ deletion' | grep -o '[0-9]*' )" | |
INS="${INS:-0}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
printf "Dangling images... " | |
docker images -q -f "dangling=true" | xargs -r docker rmi | |
echo "done." | |
printf "Unused volumes... " | |
docker volume prune -f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gi () | |
{ | |
if [ "t" != "${1:0:1}" ] | |
then | |
false | |
else | |
argv=("$@") | |
argv[0]="${argv[0]:1}" | |
git "${argv[@]}" | |
fi |