Skip to content

Instantly share code, notes, and snippets.

@punund
punund / 0_reuse_code.js
Created January 21, 2014 10:59
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#
# it suits my purposes, no warranty if is suits yours
# Iļja Ketris
#
include "/usr/share/X11/locale/en_US.UTF-8/Compose"
<Multi_key> <minus> <greater> : "→" U2192 # RIGHT
<Multi_key> <less> <minus> : "←" U2190 # LEFT
<Multi_key> <period> <space> : "…" U2026 # HORIZONTAL ELLIPSIS, многоточие
for i in */; do
cd $i
zip $i *
cd ..
done
@punund
punund / angular-inspect
Created January 28, 2015 22:55
How to check Angular service from console
angular.element(document.querySelector('.ng-scope')).injector().get('MyService')
@punund
punund / dokku.log
Created February 11, 2015 20:33
dokku deploy www
++ id -un
+ [[ root != \d\o\k\k\u ]]
+ [[ deploy != plugins-install* ]]
+ [[ deploy != \p\l\u\g\i\n\s\-\u\p\d\a\t\e ]]
+ sudo -u dokku -E -H /usr/local/bin/dokku deploy www
++ id -un
+ [[ dokku != \d\o\k\k\u ]]
+ [[ -n '' ]]
+ case "$1" in
+ APP=www
@punund
punund / mass-rename
Last active August 29, 2015 14:15
переименовать файлы
for i in *; do
((c=0))
for j in $i/*; do
((c++))
mv $j $j-$c
done
done
FROM ubuntu
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install postfix postfix-pcre -y --force-yes
RUN DEBIAN_FRONTEND=noninteractive apt-get install syslog-ng syslog-ng-core -y --force-yes
ADD etc /etc/
RUN cp /etc/resolv.conf /etc/services /var/spool/postfix/etc/
@punund
punund / list-monad.hs
Last active October 30, 2015 14:34
List monad in action
{- монада это необязательно последовательное исполнение -}
import Control.Monad
newlist ∷ [(Int, Int)]
newlist =
do x <- [1..3]
y <- [11..12]
guard $ x + y > 13
return (x, y)
@punund
punund / ride.hs
Last active November 3, 2015 00:14
leap ∷ Coor → Int2 → WithProblem Maybe Move
leap src dxy = do
let dst = src ~+ dxy
sqr ← squareAtM dst
kind ← captureM $ colorOnSquare sqr
return $ case kind of
SimpleMove -> [ Relocate src dst ]
CaptureMove -> [ Vacate dst, Relocate src dst ]
-- | linear movement by vector ij :: Int2
@punund
punund / trees.hs
Created November 10, 2015 20:58
Data.Tree
data Tree a = Node a (Forest a)
type Forest a = [Tree a]