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 / freq.html
Created March 29, 2014 17:35
[quick-dirty] html+js hack for cracking the substitution encryption.
<h3>encrypted sentence</h3>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<input name="text" size="40" />
<button id="mk">make</button>
<hr />
<h3>decrypted sentence</h3>
<div id="box"></div>
<hr />
@neizod
neizod / bubble.cpp
Last active August 29, 2015 14:06
Sorting Algorithms
#include <iostream>
using namespace std;
int arr[] = {2,5,3,9,1,0,7,4,8,6};
void show(int i=-1) {
for (int k=0; k<10; k++) {
if (i-1 == k) cout << "\x1b[37;1m";
if (i == k) cout << "\x1b[31;1m";
cout << arr[k];
@neizod
neizod / kmeans.py
Last active August 29, 2015 14:07
k-means clustering.
#!/usr/bin/env python3
import sys
from itertools import count
class Point(object):
def __init__(self, pp):
self.x, self.y = pp
#!/usr/bin/env python3
from numpy import matrix, zeros
class RandomWalk(object):
limpow = 10**9
offset = [(0,-1), (0,1), (-1,0), (1,0)]
@neizod
neizod / it.ipynb
Created May 11, 2015 00:26
test nbviewer
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@neizod
neizod / hellgist.b
Created September 28, 2011 15:54
Hello Gist!
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<-.>------.++++++++++.+.>+.>.
@neizod
neizod / LICENSE.txt
Created October 2, 2011 19:52 — forked from 140bytes/LICENSE.txt
GCD - recursive style, variable arguments.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 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 / LICENSE.txt
Created October 5, 2011 15:50 — forked from 140bytes/LICENSE.txt
Factorization
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 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 / LICENSE.txt
Created October 6, 2011 15:25 — forked from 140bytes/LICENSE.txt
Substitution Cipher
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 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 / zzz.py
Created December 17, 2011 18:02
zzZ
import time
i,j=0,0
while True:
if not j:
time.sleep(0.5)
print("\r",end='')
if not i:
print("Z",end='')
else: