Skip to content

Instantly share code, notes, and snippets.

View puzzlet's full-sized avatar

정 경훈 (Kyung-hown Chung) puzzlet

View GitHub Profile
@hrldcpr
hrldcpr / tree.md
Last active May 1, 2024 00:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
@crofty
crofty / index.html
Last active October 22, 2021 08:24
A example of using Google Map tiles with the Leaflet mapping library - http://matchingnotes.com/using-google-map-tiles-with-leaflet
<!DOCTYPE html>
<html>
<head>
<title>Leaflet</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
<script src="http://matchingnotes.com/javascripts/leaflet-google.js"></script>
</head>
<body>
@albyr
albyr / traceroute 216.81.59.173
Created February 10, 2013 10:10
The results of a traceroute to 216.81.59.173
Tracing route to FIN [216.81.59.173]:
1 76 ms 96 ms 99 ms 192.168.1.254
2 * * * Request timed out.
3 18 ms 18 ms 17 ms 195.66.225.189
4 22 ms 24 ms 24 ms 10gigabitethernet1-1.core1.lon1.he.net [195.66.224.21]
5 24 ms 24 ms 24 ms 10gigabitethernet2-4.core1.par2.he.net [72.52.92.42]
6 97 ms 97 ms 100 ms 10gigabitethernet7-1.core1.ash1.he.net [184.105.213.93]
7 109 ms 109 ms 112 ms 10gigabitethernet1-2.core1.atl1.he.net [184.105.213.110]
8 109 ms 108 ms 108 ms 216.66.0.26
@xnuk
xnuk / 아희.md
Last active September 5, 2019 22:42

아희 유형 A 프로그래밍 언어 설명 문서 - draft 버전 1.2.0

한국어

한국어는 애매합니다. 정확히는 명료한 언어 설명 문서를 적기에는 부족한 점이 좀 있습니다. 따라서, 본론에 들어가기 전 몇 가지 표현을 미리 명료히 하겠습니다.

  • A에서 B까지 / A부터 B까지: A와 B 사이에 있는 구간에서 A와 B를 포함한 구간을 칭합니다.
  • (U+AC00) 이상 (U+D7A3) 이하: 유니코드의 문자 번호가 십육진수 표기로 AC00 이상 D7A3 이하에 속하는 모든 유니코드 문자를 칭합니다.
  • 이 문서에서의 숫자 표기는 별도로 정의하지 않는 이상 십진수 표기를 사용합니다.
    • U+AC00U+ 뒤에 바로 따라 나오는 네 자리 문자는 십육진수 표기를 사용합니다.
  • 받침종성은 동의어로 봅니다.
@dagss
dagss / gist:5008118
Last active September 20, 2017 01:33
marked_yaml
"""
A PyYAML loader that annotates position in source code.
The loader is based on `SafeConstructor`, i.e., the behaviour of
`yaml.safe_load`, but in addition:
- Every dict/list/unicode is replaced with dict_node/list_node/unicode_node,
which subclasses dict/list/unicode to add the attributes `start_mark`
and `end_mark`. (See the yaml.error module for the `Mark` class.)
@stania
stania / setupVSEnv.py
Last active June 11, 2016 21:45
python implementation replacing "call vsvars32.bat"
from subprocess import Popen
import os, subprocess
def parseEnv(envoutput):
handle_line = lambda l: tuple(l.rstrip().split("=", 1))
pairs = map(handle_line, envoutput)
valid_pairs = filter(lambda x: len(x) == 2, pairs)
valid_pairs = [(x[0].upper(), x[1]) for x in valid_pairs]
return dict(valid_pairs)
/*
code
{
char: string,
cho: number,
jung: number,
jong: number,
eliminate: boolean
}
*/
@klutzy
klutzy / hello.windows.rs
Created December 6, 2013 07:45
Rust with Emscripten and win32.js
// From rust get `libstd/libc.rs` to the working dir.
// From rust-windows <https://github.com/klutzy/rust-windows>
// copy whole `ll/` dir to the working dir and
// patch some code: (TODO)
// From win32.js <https://github.com/klutzy/win32.js>, copy
// `library_win32.js` and `window.js` to working dir.
//
// emscripten uses le32-unknown-nacl triple but rustc doesn't know it now.
// So just use similar target instead.
// Here I use `win32` because libc.rs needs it.
anonymous
anonymous / gist:4336370
Created December 19, 2012 12:32
import re
import urllib
from bs4 import BeautifulSoup
import datetime
def read_percentage(soup):
return float(re.search(r'\((\d+\.\d+)\)',repr(soup)).groups()[0])
f = urllib.urlopen('http://info.nec.go.kr/electioninfo/electionInfo_report.xhtml?electionId=0020121219&requestURI=%2Felectioninfo%2F0020121219%2Fvc%2Fvccp09.jsp&topMenuId=VC&secondMenuId=VCCP&menuId=VCCP09&statementId=VCCP09_%231&electionCode=1&cityCode=0&sggCityCode=0&x=26&y=8')
html = f.read()