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

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:

docker images | grep 'days ago\|weeks ago' | grep -v 'centos' | awk '{print $3}' | xargs --no-run-if-empty docker rmi
@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');
import os
from collections import defaultdict
LIMIT = 1
file_dict = defaultdict(list)
remove_files = []
for filename in os.listdir('.'):
start = filename.split('-')[0]
@AyumuKasuga
AyumuKasuga / gist:6619898
Created September 19, 2013 06:55
django csrf ajax
$.ajaxSetup({
beforeSend: function(xhr, settings) {
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
@AyumuKasuga
AyumuKasuga / templater.js
Created August 16, 2012 19:50
simple js templater
function render(template, kwargs){
this.template = template
this.kwargs = kwargs
this.render_str = function(temp, kwargs){
re = /{{(.*?)}}/g
if(kwargs == undefined){kwargs=this.kwargs}
return temp.replace(re, function(a,b){
clean_key = b.trim();
if(kwargs[clean_key]){
@AyumuKasuga
AyumuKasuga / saveimage.py
Created June 21, 2012 14:11
save images from 2ch.so
#!/usr/bin/env python2
#coding: utf-8
import gevent.monkey
gevent.monkey.patch_socket()
import sys
import os
from urlparse import urlparse
import urllib