Skip to content

Instantly share code, notes, and snippets.

View neizod's full-sized avatar
📚
phd completed, seeking my new goal in life

Nattawut Phetmak neizod

📚
phd completed, seeking my new goal in life
View GitHub Profile
@neizod
neizod / LICENSE.txt
Created September 3, 2012 00:40 — forked from Python1Liners/LICENSE.txt
Google Recruiting Board
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Nattawut Phetmak <http://about.me/neizod>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@neizod
neizod / e-convergent.hs
Created September 2, 2012 19:45
Compute mathematical constant `e`.
e n = 1 + (foldr1 (\ a x -> a + 1 / x) $ take n [i ^ j | i <- [2,4..], j <- [0,0,1]])
-- sample:
-- e 1 -> 2.0
-- e 2 -> 3.0
-- e 6 -> 2.71875
-- e 100 -> 2.7182818284590455
-- see more:
-- <http://en.wikipedia.org/wiki/E_(mathematical_constant)#Representations>
@neizod
neizod / c.hs
Created August 24, 2012 23:17
power set of subtraction of n where every element in each subset are greater than m.
repile r 1 d m s = if d >= head s then (d:s):r else r
repile r p d m s = do
if d > m
then repile (repile r (p-1) (d-m) m (m:s)) p d (m+1) s
else r
mkpile r 0 d m = mkpile r (d `div` m) d m
mkpile r p d m = do
if p > 1
then mkpile (repile r p d m []) (p-1) d m
@neizod
neizod / c.py
Created August 21, 2012 18:56
ACM-ICPC Thailand Central 2012
from fractions import Fraction
from math import factorial
from operator import mul
from functools import reduce
def product(member):
return reduce(mul, member)
def repile(minimum, remain_piles, remain_dishes, case, stack=[]):
@neizod
neizod / LICENSE.txt
Created July 28, 2012 15:53 — forked from Python1Liners/LICENSE.txt
Letter A
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Nattawut Phetmak <http://about.me/neizod>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@neizod
neizod / letex_logo.tex
Created June 26, 2012 12:31
Redefine \LaTeX with LaTeX.
\documentclass{article}
\usepackage{relsize}
\newcommand{\myLaTeX}{%
L%
\kern-.36em \lower-.47ex \hbox{\smaller{\smaller{A}}}%
\kern-.15em T%
\kern-.16em \lower+.51ex \hbox{E}%
\kern-.27ex X%
}
@neizod
neizod / README.md
Created June 14, 2012 15:52
[Blockly] Quicksort - Recursive

Quicksort

Since Blockly doesn't accept function's argument & every variables is global. So I made a recursive stack just for this.

See the picture or copy this xml code and paste into XML tab in this page to see live demo yourself.

May the code be with you. :3

@neizod
neizod / sourceslist.out
Created May 18, 2012 13:49
cat sourceslist
deb http://packages.linuxmint.com/ lisa main upstream import
deb http://archive.ubuntu.com/ubuntu/ oneiric main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ oneiric-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ oneiric-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu/ oneiric partner
deb http://packages.medibuntu.org/ oneiric free non-free
#deb http://archive.getdeb.net/ubuntu oneiric-getdeb apps
#deb http://archive.getdeb.net/ubuntu oneiric-getdeb games
@neizod
neizod / a.py
Created May 5, 2012 18:33
[CodeJam] Safety in Numbers
for t in range(int(input())):
n, *points = [int(v) for v in input().split()]
x = sum(points)
avg = x * 2 / n
nomore = [p > avg for p in points]
if any(nomore):
n = sum(not b for b in nomore)
over = sum(p * b for p, b in zip(points, nomore))
@neizod
neizod / LICENSE.txt
Last active April 27, 2019 07:32 — forked from 140bytes/LICENSE.txt
Fibonacci (Recursive Lambda)
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2012 Nattawut Phetmak <http://about.me/neizod>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE