Skip to content

Instantly share code, notes, and snippets.

sooop

Block or report user

Report or block sooop

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View vim_registers.txt
레지스터에는 총 10가지의 종류가 있다!!
* 이름없는 레지스터 : ""
* 10개의 번호 레지스터 : "0
* 삭제 레지스터 : "-
* 26개의 이름이 있는 레지스터 a-z : 대소문자를 구분하지 않음
* 세 종류의 읽기 전용 레지스터 : ":, "., "%
* 대체 버퍼 레지스터 : "#
* 표현식 레지스터 : "=
View hangul_code.json
{
"_LETTERS_": {
"Kiyeok": ["0x3131", ""],
"Ssangkiyeok": ["0x3132", ""],
"Kiyeok-Sios": ["0x3133", ""],
"Nieun": ["0x3134", ""],
"Nieun-Cieuc": ["0x3135", ""],
"Nieun-Hieuh": ["0x3136", ""],
"Tikeut": ["0x3137", ""],
"Ssangtikeut": ["0x3138", ""],
@sooop
sooop / jamo.py
Last active Oct 27, 2019
한글초성분리 및 낱자모 변환
View jamo.py
import jamodata
# 초성
def choseong(c):
'''초성의 자모 코드값을 리턴'''
v = ord(c)
if 0xAC00 <= v <= 0xD7A3:
key = (v - 0xac00) // 28 // 21 + 0x1100
name = jamodata.jamo_indices[key]
return chr(jamodata.letters[name])
View IntListParser.hs
import Data.Char (isDigit, isSpace)
newtype Parser a = Parser { runParser :: String -> [(a, String)]}
instance Functor Parser where
fmap f p = Parser $ \str ->
case runParser p str of
[] -> []
[(y, ys)] -> [(f y, ys)]
@sooop
sooop / example.py
Created Jun 16, 2019
비동기 PUSH-PULL 분산처리 구조 - onefile
View example.py
from multiprocessing import Process
import sys
import random
import zmq
import zmq.asyncio
import asyncio
ctx = zmq.asyncio.Context()
View publisher.py
import sys
import random
import asyncio
import zmq
import zmq.asyncio
ctx = zmq.asyncio.Context()
async def run_server(port=5556):
sock = ctx.socket(zmq.PUB)
@sooop
sooop / e001.jl
Last active Jan 10, 2019
Project Euler with Julia 001-010
View e001.jl
@elapsed sum(i for i=1:999 if i % 3 == 0 || i % 5 == 0) |> println
## FASTER SOLUTION
@time (Set(3:3:999) ∪ Set(5:5:999)) |> sum |> println
@sooop
sooop / reversed_lines.py
Created Jul 20, 2018
Read a file line by line in reversed order (lazily) in python3
View reversed_lines.py
def reversed_lines(filepath, sep='\n'):
token = sep.encode()
buffer = bytearray()
chunk_size = 1024
c = 0
with open(filepath, 'rb') as f:
total_bytes = f.seek(0,2)
# 버퍼에 한 번을 읽어들인다.
while True:
c += 1
@sooop
sooop / prime.py
Created May 10, 2018
소수 판별함수
View prime.py
def is_prime(n: int) -> bool:
if n < 2: return False
if n < 4: return True
if n % 2 == 0 or n % 3 == 0:
return False
if n < 9: return True
k, l = 5, n ** 0.5
while k <= l:
if n % k == 0 or n % (k+2) == 0:
return False
@sooop
sooop / main.swift
Last active Jan 30, 2018
문자열의 편집거리 구하기
View main.swift
private extension String {
subscript(i:Int) -> Character {
let idx = index(startIndex, offsetBy: i)
return self[idx]
}
}
struct Array2D<T> {
let width: Int, height: Int
You can’t perform that action at this time.