Skip to content

Instantly share code, notes, and snippets.

#
# 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 / fen_controller.rb
Created June 19, 2011 13:59
Dynamic creation of chess diagrams
#
# responds to requests with Forsyth-Edwards notation in URL with an image:
# http://dia-x.info/fen/2S5/1bQKpR2/4s3/2bkpP2/Sr1p2r1/1P1R3B/1B2s3/8
#
class FenController < ApplicationController
include Magick
@punund
punund / author.rb
Created June 19, 2011 15:45
Generation of alphanumeric person handle
#
# This automatically creates a "handle" upon creation of person's record.
#
# "John Doe"'s handle shall look like "DO<x>J", where <x> is a minimal necessary number of digits,
# so we have to look up the existing handles first. We exclude zeros (to avoid confusion with Os)
# and ones (to exclude jealousy "to be the first"), so we conveniently employ octal digits and add
# two subsequently. We also have to do the best effort to normalize last names (drop diacritics,
# honorifics, Celtic and Dutch name prefixes, sr/jr suffixes, etc. to maximize variance.
#
# See this in action at http://dia-x.info/authors
@punund
punund / .rvmrc
Created November 16, 2011 22:52
.rvmrc common template
_RUBY=ruby-1.9.3
_PROJECT=dia-x
export rvm_gem_options="--no-rdoc --no-ri"
if [[ -s "${rvm_path:-$HOME/.rvm}/environments/$_RUBY@$_PROJECT" ]]
then
. "${rvm_path:-$HOME/.rvm}/environments/$_RUBY@$_PROJECT"
else
rvm --create use "$_RUBY@$_PROJECT"
@punund
punund / splitter.sh
Created November 24, 2011 00:16
splitter in bash
#!/bin/bash
[[ $1 =~ ([[:alnum:]]+)-([[:alnum:]]+) ]] || exit 1
[[ "$2" = suffix ]] &&
echo ${BASH_REMATCH[2]} && exit 0
echo ${BASH_REMATCH[1]} && exit 0