Skip to content

Instantly share code, notes, and snippets.

# before corectld (mehserve redirect works)
r scrub-anchor "com.apple/*" all fragment reassemble
r anchor "com.apple/*" all
n nat-anchor "com.apple/*" all
n rdr-anchor "com.apple/*" all
com.apple r anchor "200.AirDrop/*" all
com.apple r anchor "250.ApplicationFirewall/*" all
com.apple/200.AirDrop/Bonjour r pass in on p2p0 inet6 proto udp from any to any port = 5353 keep state
com.apple/200.AirDrop/Bonjour r pass out on p2p0 proto tcp all flags any keep state
@vitaly
vitaly / pfdump.sh
Created November 30, 2016 14:18
script to dump PF status
#!/bin/bash
function pfprint() {
if [ -n "$1" ];then
sudo pfctl -a "$2" -s"$1" 2>/dev/null
else
sudo pfctl -s"$1" 2>/dev/null
fi
}
@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
#!/bin/bash
echo Removing all dangling images
docker images -q --filter "dangling=true" \
| xargs docker rmi
#!/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
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" "$@"
@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
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
<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>
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