Skip to content

Instantly share code, notes, and snippets.

View PetrGlad's full-sized avatar
🚶‍♂️
.

Petr Gladkikh PetrGlad

🚶‍♂️
.
  • 10:45 (UTC +04:00)
View GitHub Profile
# 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"
(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]
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'
FILETOWATCH=script.py
TARGET=me@host:/home/me/
while inotifywait -e close_write $FILETOWATCH;
do
scp $FILETOWATCH $TARGET;
done
@PetrGlad
PetrGlad / test-repo-running.sh
Created August 4, 2015 06:29
Shell test if local Docker repository is running
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
@PetrGlad
PetrGlad / fibonacci.go
Created July 24, 2015 10:34
My exercises for "A tour of Go"
func fibonacci_seq() func() int {
f1, f2 := 0, 1
return func() int {
f1, f2 = f2, f1 + f2
return f2
}
}
@PetrGlad
PetrGlad / attach-minecraft.sh
Last active August 29, 2015 14:25
Minecraft on Raspberry Pi
#!/bin/bash
# Use this to attach to running server and issue admin commands
tmux attach -t minecraft
@PetrGlad
PetrGlad / install-haskell.sh
Created July 14, 2015 18:30
Haskell env setup
apt-get install haskell-platform hoogle hlint
alias Hi='hoogle --info --color'
alias Ho='hoogle --color'
@PetrGlad
PetrGlad / bak.py
Last active August 29, 2015 14:20
bak.py
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:
@PetrGlad
PetrGlad / lxft-logins.sql
Last active August 29, 2015 14:14
SQL katas
-- 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
);