Skip to content

Instantly share code, notes, and snippets.

View 2minchul's full-sized avatar
😀

Colin (MinChul Lee) 2minchul

😀
View GitHub Profile
@2minchul
2minchul / Dockerfile
Last active February 14, 2019 04:23
ubuntu-kr
FROM ubuntu:16.04
RUN sed -i '[email protected]@kr.archive.ubuntu.com@g' /etc/apt/sources.list
@2minchul
2minchul / main.c
Last active August 5, 2019 05:03
signal example for C
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
static void sig_usr(int);
@2minchul
2minchul / note.sh
Last active May 14, 2018 08:22
install rpi-source for gcc-4.9 build
sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source && sudo chmod +x /usr/bin/rpi-source && /usr/bin/rpi-source -q --tag-update
# check required gcc version
cat /proc/version
# install gcc 4.9
sudo apt update -y
sudo apt-get install gcc-4.9 g++-4.9 -y
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50
@2minchul
2minchul / nginx.conf
Created November 14, 2018 16:33
nginx.conf sample
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user ec2-user;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
@2minchul
2minchul / README.md
Last active December 17, 2018 23:53
qmaze tutorial
@2minchul
2minchul / example.py
Created January 14, 2019 09:47
send gevent http request with second limit
from gevent import monkey
monkey.patch_all()
import gevent
from gevent.pool import Pool
from gevent.lock import Semaphore
import time
from urllib.request import urlopen
@2minchul
2minchul / example.py
Created January 18, 2019 03:50
A simple example of tenacity with aiohttp
import asyncio
import random
import logging
import aiohttp
import tenacity
logging.basicConfig(level=logging.DEBUG)
@2minchul
2minchul / fibonacci.py
Last active February 25, 2019 04:32
A simple solution for fibonacci number.
from functools import lru_cache
@lru_cache(maxsize=None) # caching all them, do not discard cache
def fibonacci_dynamic_recursive(n):
if n == 0 or n == 1:
return n
return fibonacci_dynamic_recursive(n - 1) + fibonacci_dynamic_recursive(n - 2)
from collections import Counter, defaultdict
def solution(genres, plays):
song_limit = 2
answer = []
songs = defaultdict(dict)
_genre_counter_dict = defaultdict(int)
def decrypt(row, size):
mask = 1 << (size - 1)
while mask:
yield '#' if (row & mask) else ' '
mask = mask >> 1
def solution(n, arr1, arr2):
answer = []
for row in (a|b for a, b in zip(arr1, arr2)):
answer.append(''.join(decrypt(row, n)))