Skip to content

Instantly share code, notes, and snippets.

View AyumuKasuga's full-sized avatar
🤔
🤔

Andrei Kostakov AyumuKasuga

🤔
🤔
View GitHub Profile
*nat
:PREROUTING ACCEPT [3423:660395]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [43075:8811003]
:POSTROUTING ACCEPT [40442:8299404]
:DOCKER - [0:0]
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
-A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE
-A POSTROUTING -s 172.17.0.3/32 -d 172.17.0.3/32 -p tcp -m tcp --dport 5432 -j MASQUERADE
#!/bin/sh
if [ "$1" = "" ]; then
echo "Usage: kshell <pod>"
exit 1
fi
COLUMNS=`tput cols`
LINES=`tput lines`
TERM=xterm
kubectl exec -i -t $1 env COLUMNS=$COLUMNS LINES=$LINES TERM=$TERM bash
@AyumuKasuga
AyumuKasuga / wifi-resume.service
Created August 27, 2017 14:09
/etc/systemd/system/wifi-resume.service
#/etc/systemd/system/wifi-resume.service
#sudo systemctl enable wifi-resume.service
[Unit]
Description=Restart networkmanager at resume
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target
[Service]
Type=oneshot
docker images | grep 'days ago\|weeks ago' | grep -v 'centos' | awk '{print $3}' | xargs --no-run-if-empty docker rmi

Keybase proof

I hereby claim:

  • I am AyumuKasuga on github.
  • I am ayumukasuga (https://keybase.io/ayumukasuga) on keybase.
  • I have a public key whose fingerprint is FCCB 2936 1732 D16D 854C 2607 B772 AA0B 1657 F017

To claim this, I am signing this object:

@AyumuKasuga
AyumuKasuga / list_filter_collapse.js
Last active January 27, 2016 15:10 — forked from jjdelc/list_filter_collapse.js
Collapse list_filter in Django admin
;(function($){
ListFilterCollapsePrototype = {
bindToggle: function(){
var that = this;
this.$filterEl.click(function(){
that.$filterList.slideToggle();
});
},
init: function(filterEl) {
this.$filterEl = $(filterEl).css('cursor', 'pointer');
@AyumuKasuga
AyumuKasuga / .vimrc
Created December 4, 2014 13:14
vimrc
set hidden
set nocompatible
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
set scrolloff=10
set autoindent
set smartindent
set number
@AyumuKasuga
AyumuKasuga / gist:718e45841c4a081a38fd
Last active August 29, 2015 14:05
router iptables
#iptables -t nat -A PREROUTING -i br0 -p udp --dport 53 -j DNAT --to-destination 192.168.47.100:9053
#iptables -t nat -A PREROUTING -i br0 -p tcp -m tcp -d ! 192.168.47.100 -j DNAT --to-destination 192.168.47.100:9040
#iptables -t nat -A PREROUTING -i br1 -j DROP
/etc/iptables.rules
# Generated by iptables-save v1.4.14 on Thu Jun 5 19:52:31 2014
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A PREROUTING -i wlan0 -p udp --dport 53 -j REDIRECT --to-ports 53
-A PREROUTING -i wlan0 -p tcp --syn -j REDIRECT --to-ports 9040
import os
from collections import defaultdict
LIMIT = 1
file_dict = defaultdict(list)
remove_files = []
for filename in os.listdir('.'):
start = filename.split('-')[0]