Skip to content

Instantly share code, notes, and snippets.

View kartikm's full-sized avatar
🏠
Working from home

Kartik Mistry kartikm

🏠
Working from home
View GitHub Profile
# Share ppp0 to wlan0
ifconfig wlan0 down
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iwconfig wlan0 mode Ad-Hoc
M[16],X=16,W,k;main(){T(system("stty cbreak")
);puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i
,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M
[w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<<
(l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k)
]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d
-1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X]
*i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4;
)s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4||
puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2
@kartikm
kartikm / JavascriptReferences.md
Last active December 20, 2015 00:09 — forked from samyakbhuta/JavascriptReferences.md
JavaScript Resources
@kartikm
kartikm / output.py
Last active December 15, 2015 20:19 — forked from shabda/gist:5317134
What will be output of this? :)
import random
import string
def random_word_from_seed(seed, l):
random.seed(seed)
letters = string.ascii_lowercase
return ''.join([random.choice(letters) for i in range(l)])
print random_word_from_seed(1944062, 5) +" "+random_word_from_seed(2068527, 5)