Skip to content

Instantly share code, notes, and snippets.

View ziwon's full-sized avatar
🗿
?!

Yeongpil Y. ziwon

🗿
?!
View GitHub Profile
@ziwon
ziwon / client.py
Created March 3, 2017 04:33 — forked from AndreiPashkin/client.py
Python asyncio coroutines pipelining and exception propagation sandbox
#!/usr/bin/env python
# coding=utf-8
"""Client that demonstrates processing pipeline."""
import asyncio
from functools import partial
import logging
logging.basicConfig(level='DEBUG')
@ziwon
ziwon / init.vim
Created April 4, 2017 04:07 — forked from toastal/init.vim
Nvim conf on Mac
let g:python_host_skip_check = 1
let g:python3_host_skip_check = 1
let g:python_host_prog = '/usr/local/bin/python2'
let g:python3_host_prog = '/usr/local/bin/python3'
let g:EditorConfig_exec_path = '/usr/local/bin/editorconfig'
let g:EditorConfig_core_mode = 'external_command'
" Deoplete
@ziwon
ziwon / config.yml
Created April 14, 2017 06:19
Parse YAML from bash with sed and awk.
development:
adapter: mysql2
encoding: utf8
database: my_database
username: root
password:
apt:
- somepackage
- anotherpackage
@ziwon
ziwon / gist:3ef1a6b78698ba818a5e63c83c3c9c90
Last active August 30, 2017 04:13 — forked from flaviovdf/gist:4174938
http headers tshark
# localhost
sudo tshark -i lo
# or add loopback interface
sudo ifconfig lo0 alias 127.0.0.0 up
sudo tshark -i lo0
# eth0
sudo tshark -i eth0 -f 'port 80 or 443' -R 'http.host matches ".*?youtube\.com.*"' -S -V -l -T fields -e ip.src -e ip.src_host -e ip.dst -e ip.dst_host -e http.accept -e http.accept_encoding -e http.accept_language -e http.authbasic -e http.authorization -e http.cache_control -e http.connection -e http.content_encoding -e http.content_length -e http.content_length_header -e http.content_type -e http.cookie -e http.date -e http.host -e http.last_modified -e http.location -e http.notification -e http.proxy_authenticate -e http.proxy_authorization -e http.proxy_connect_host -e http.proxy_connect_port -e http.referer -e http.request -e http.request.full_uri -e http.request.method -e http.request.uri -e http.request.version -e http.response -e http.response.code -e http.response.phrase -e http.sec_websocket_accept -e http.sec_websocket_extensions -e http.sec_websocket_key -e http.sec_websock
@ziwon
ziwon / kubectl.md
Created September 29, 2017 05:35 — forked from so0k/kubectl.md
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@ziwon
ziwon / collapse_weekdays.py
Created September 30, 2017 02:46
Collapse Weekdays
days_default = {'월':0, '화':1, '수':2, '목':3, '금':4, '토':5, '일':6}
# input: 0, 1, 2, 4, 6
# output: 0~2, 4, 6
reverse= dict((v, k) for k, v in days_default.items())
def collapse_weekdays(days):
days = list(map(lambda k: days_default.get(k), days))
shift = lambda n, k: (n + 1 < k and days[n + 1] - days[n] == 1) and shift(n + 1, k) or n
@ziwon
ziwon / docker-cleanup-resources.md
Created October 19, 2017 01:53 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@ziwon
ziwon / sed cheatsheet
Created February 5, 2018 02:34 — forked from un33k/sed cheatsheet
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@ziwon
ziwon / PrivateEthereumCluster.md
Created April 1, 2018 16:49
Setup private Ethereum network with Docker

Setup private Ethereum network with Docker

Ethereum is a decentralized platform that runs smart contracts: applications that run exactly as programmed without any possibility of downtime, censorship, fraud or third party interference.

This is a step-by-step guide, how to setup private Ethereum network. 

We’ll set up a network and create two simple JSON-RPC clients in order to communicate with our Ethereum nodes.

@ziwon
ziwon / sha256_encode.py
Created April 23, 2018 23:37
Spring Security 모듈의 StandardPasswordEncoder encode() 함수를 구현
def sha256_encode(secret, password):
"""
Spring Security 모듈의 StandardPasswordEncoder encode() 함수를 구현
:param secret:
:param password:
:return:
"""
salt_key_length = 8
max_hash_rounds = 1024