Skip to content

Instantly share code, notes, and snippets.

View qbx2's full-sized avatar
🦀

Sunyeop Lee qbx2

🦀
View GitHub Profile
@qbx2
qbx2 / sendiface.py
Created August 18, 2020 10:58 — forked from rgov/sendiface.py
'''
Use the IP_BOUND_IF socket option to bind to a specific network interface on macOS.
'''
import socket
IP_BOUND_IF = 25
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.IPPROTO_IP, IP_BOUND_IF, socket.if_nametoindex('en0'))
@qbx2
qbx2 / swap.sh
Last active October 25, 2020 08:45
configure swap & swappiness
#!/bin/sh
# Do argument checks
if [ ! "$#" -ge 1 ]; then
echo "Usage: $0 {size}"
echo "Example: $0 4G"
echo "Usage: $0 {size} {swappiness}"
exit 1
fi
#!/bin/bash
snap install microk8s --classic
@qbx2
qbx2 / setup_vultr_private_network.sh
Last active October 25, 2020 08:52
vultr private network for ubuntu
#!/bin/bash
set -ex
# Do argument checks
if [ ! "$#" -ge 1 ]; then
echo "Usage: $0 {ip_addr}"
exit 1
fi
IP_ADDRESS=$1
class FileBackedCircularBuffer:
def __init__(self, cls, maxlen):
f = tempfile.TemporaryFile()
filesize = maxlen * cls.format.size
f.truncate(filesize)
self.buffer = mmap.mmap(f.fileno(), filesize)
self.cls = cls
self.maxlen = maxlen
self.start_index = 0 # inclusive
self.end_index = 0 # exclusive
from collections import Counter
import itertools
lines = '''스윕 이그나이트 이럽션
이그나이트 이프리트 리젼
이럽션 이그나이트 이프리트
이그나이트 스윕 이럽션
이그나이트 스윕 이프리트
이그나이트 리젼 이럽션
이그나이트 이럽션 이프리트