Skip to content

Instantly share code, notes, and snippets.

@vitaly
vitaly / x
Last active August 29, 2016 12:25
Run the command in x tmux splits. e.g. `bash x 4 iex` will run `iex` in 4 spilts in tmux
#!/bin/bash -x
N=$1; shift
if [ -z "$N" -o -z "$1" ]; then
cat <<_
Usage: $0 N COMMAND
_
exit 1
fi
Postgres.app/Contents/MacOS/share/man/man1:
cjpeg.1 cs2cs.1 ecpg.1 pg_archivecleanup.1 pg_dump.1 pg_standby.1 postgres.1 reindexdb.1
clusterdb.1 djpeg.1 geod.1 pg_basebackup.1 pg_dumpall.1 pg_test_fsync.1 postmaster.1 vacuumdb.1
createdb.1 dropdb.1 initdb.1 pg_config.1 pg_receivexlog.1 pg_test_timing.1 proj.1 vacuumlo.1
createlang.1 droplang.1 jpegtran.1 pg_controldata.1 pg_resetxlog.1 pg_upgrade.1 psql.1 wrjpgcom.1
createuser.1 dropuser.1 oid2name.1 pg_ctl.1 pg_restore.1 pgbench.1 rdjpgcom.1
Postgres93.app/Contents/MacOS/share/man/man1:
bmp2tiff.1 fax2ps.1 jpegtran.1 ras2tiff.1 sgi2tiff.1 tiff2ps.1 tiffcrop.1 tiffinfo.1 tiffsv.1
cjpeg.1 fax2tiff.1 pal2
concern :v2 do
namespace :user do
resources :devices, only: [] do
resources :services, only: [:show, :update], controller: 'device_services'
resources :users, only: [] do
resources :services, only: [:show, :update], controller: 'device_user_services'
end
end
end
end
<env:Envelope xmlns:lol0="http://ws.ottsso.singtel.com/clientauthws/" xmlns:lol1="http://ws.ottsso.singtel.com/commonottsso/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
</env:Header>
<env:Body>
<lol0:checkSSOUserInfoParams>
<lol0:header>
<lol1:clientId>SMARTHOMERCS</lol1:clientId>
<lol1:timeStamp>2014-09-25T14:31:03+02:00</lol1:timeStamp>
<lol1:signature>123</lol1:signature>
</lol0:header>
root@8751e3abfcea:/# ps ax
PID TTY STAT TIME COMMAND
1 ? Ss+ 0:00 /sleep 60
11 ? Z 0:00 [sleep] <defunct>
12 ? Ss 0:00 bash
27 ? R+ 0:00 ps ax
@vitaly
vitaly / build.mak
Created May 27, 2015 15:32
generic Make build target for building docker images
# generic build rule
docker/build/%: docker/recipes/%/Dockerfile .dockerignore
@echo
@echo
@echo =================================== Building $@
@echo
@echo
docker build --rm -t $* -f "$<" .
docker inspect --format="{{.Id}}" $* > $@
@echo
DOCKER="`which docker`"
function docker()
{
if [ -n "$1" ]; then
local cmd="$1"; shift
if which "docker-$cmd" > /dev/null; then
"docker-$cmd" "$@"
else
"$DOCKER" "$cmd" "$@"
#!/bin/bash
# cleanup all stopped containers
# except for those that have 'data' in the name
echo Removing all stopped non-data containers
docker ps --filter "status=exited" \
| grep -v data \
| grep -v ^CONTAINER \
| awk '{print $1}' \
| xargs docker rm
#!/bin/bash
echo Removing all dangling images
docker images -q --filter "dangling=true" \
| xargs docker rmi
@vitaly
vitaly / setup.py
Created July 12, 2016 13:03
setup for rs485 (WARNING: doesn't wori! :))
import serial, fcntl, struct, time
ser = serial.Serial(
port='/dev/ttyS4',
# baudrate=57600,
baudrate=9600,
timeout=1,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS