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
# https://stackoverflow.com/questions/33073931/error-cannot-connect-to-the-docker-daemon-is-docker-d-running-on-this-host#33079340 | |
# https://docs.docker.com/engine/admin/systemd/ | |
cat >>/etc/default/docker | |
# Force OverlayFS for storage driver | |
DOCKER_OPTS="$DOCKER_OPTS -s overlay" |
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
(ns lab.rle) | |
(->> (partition-by identity "abbasdfrressaaaa") | |
(mapcat (fn [r] | |
[(first r) (count r)])) | |
(apply str)) | |
(->> | |
(concat "abbasdfrressaaaa" [nil]) ;; XXX To help writing last chunk | |
(reduce (fn [[result last-char run-count] ch] |
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
alias Df='df -B1m' | |
alias Gdc='git svn dcommit' | |
alias Gg='git gui&' | |
alias Ggm='A=$(__git_ps1); echo "${A:2:-1} -" > .git/GITGUI_BCK' | |
alias Gk='gitk&' | |
alias Gp='git stash pop' | |
alias Gq='qgit&' | |
alias Grl='git reflog --decorate --color | grep -E "^\S+ \(" | head -n 20' | |
alias Gs='git status' | |
alias Gsh='git stash save' |
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
FILETOWATCH=script.py | |
TARGET=me@host:/home/me/ | |
while inotifywait -e close_write $FILETOWATCH; | |
do | |
scp $FILETOWATCH $TARGET; | |
done |
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
if [ `netstat --tcp --listening --numeric | grep '127.0.0.1:5000' | wc -l` -eq 0 ] | |
then | |
echo "Docker repository is not available" | |
else | |
echo "Docker repository is up" | |
endif |
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
func fibonacci_seq() func() int { | |
f1, f2 := 0, 1 | |
return func() int { | |
f1, f2 = f2, f1 + f2 | |
return 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
#!/bin/bash | |
# Use this to attach to running server and issue admin commands | |
tmux attach -t minecraft |
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
apt-get install haskell-platform hoogle hlint | |
alias Hi='hoogle --info --color' | |
alias Ho='hoogle --color' |
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
DOC = """ | |
This script creates/restores_from backup copy of given | |
file (pushes/pops backup file into/from stack of backups) | |
Revision 3 | |
Caveat: This script may work incorrectly if there are pre-existing | |
files which look like backups i.e. files matching ".+\.#[a-zA-Z]*[0-9]+" | |
Examples: |
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
-- Given two tables users and login records show first login time on each day | |
-- SQL is for Postgres | |
create table users ( | |
name varchar(64) primary key | |
); | |
create table log ( | |
user_name varchar(64) references users (name) not null, | |
date timestamp | |
); |