Skip to content

Instantly share code, notes, and snippets.

View ziozzang's full-sized avatar

Jioh L. Jung ziozzang

View GitHub Profile
@ziozzang
ziozzang / docker_netns_sync.sh
Last active August 29, 2015 14:22
sync docker container network namespace / bash version
#!/bin/bash
# Code by Jioh L. Jung (ziozzang@gmail.com)
NETNS=/var/run/netns
mkdir -p ${NETNS}
function remove_missed() {
# Remove purged record.
for f in ${NETNS}/*
do
@ziozzang
ziozzang / docker-event-wait.go
Created June 18, 2015 05:31
wait until for new docker event.
/*
* Code by Jioh L. Jung (ziozzang@gmail.com)
* This code is for wait until "new docker event comming..."
* just do exit when new event comming.
* how to build by docker
* $ docker run -v /opt/wait/:/opt/wait/ -i -t google/golang \
/bin/bash -c "cd /opt/wait/ && go get github.com/samalba/dockerclient && go build"
*/
package main
@ziozzang
ziozzang / gist:7064713
Last active December 26, 2015 00:29
http://www.synapsoft.co.kr/jsp/recruit/13_apply.html 사이냅 소프트쪽의 테스트 코드를 파이썬으로 얼마나 짧게 짤 수 있을까 해서 만든 코드 사실 C/C++ 로 짜도 그게 그거...
#!/usr/bin/python
# - Code by Jioh L. Jung -
# - ziozzang@gmail.com
#
# Python Code for synapsoft test. / just for fun.! yeah!
# http://www.synapsoft.co.kr/jsp/recruit/13_apply.html
#
def c(n,s="ABCDEFGHIJKLMNOPQRSTUVWXYZ"):
return (((n-1) < 26) and s[n-1]) or (c((n-1) // 26) + s[(n-1) % 26])
@ziozzang
ziozzang / kernel-benchmark-one-line.sh
Last active January 13, 2016 14:22
Kernel compile benchmark by one line
VER=4.4 && wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-${VER}.tar.gz && tar -xzf linux-${VER}.tar.gz && rm -f linux-${VER}.tar.gz && cd linux-${VER} && make defconfig && time make -j `cat /proc/cpuinfo | grep processor | wc -l` && cd .. && rm -rf linux-${VER}
@ziozzang
ziozzang / progress.py
Last active July 25, 2016 23:02
showing progress dot on python.
# Code by Jioh L. Jung (ziozzang@gmail.com)
import time, sys
dot = [ # from https://github.com/heroku/heroku-cli-util/blob/master/lib/spinners.json
"⠋",
"⠙",
"⠹",
"⠸",
"⠼",
@ziozzang
ziozzang / ubuntu-kernel-update.sh
Created March 26, 2017 07:20
Purge / Install new kernel for Ubuntu
#!/bin/bash
sudo add-apt-repository ppa:kernel-ppa/ppa
sudo apt-get update
sudo apt-get upgrade
#Purge old Kernel
sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")

Reinstall Bash on Windows 10

  • To uninstall the Linux SubSystem in Windows
Right-click command prompt (admin)
lxrun /uninstall /full
type "y" to continue: y
  • To reinstall the Linux SubSystem in windows
curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh && \
curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` \
-o /usr/bin/docker-compose \
&& chmod +x /usr/bin/docker-compose
#Block Kernel Update. /boot partition size is too small... :(
apt-mark hold `uname -r` linux-image-generic linux-headers-generic
# Partition Resize
pvscan && vgextend localhost-vg /dev/sda3 && lvextend -l +100%FREE /dev/localhost-vg/root && resize2fs /dev/localhost-vg/root
# Set Disk Timeout.
#echo 300 > /sys/block/sda/device/timeout
sed -i 's,^exit,#exit,' /etc/rc.local
echo "swapoff -a" >> /etc/rc.local