This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def permutations(seq): | |
if not seq: | |
yield [] | |
else: | |
for i in xrange(len(seq)): | |
for p in permutations(seq[1:]): | |
yield p[0:i] + [seq[0]] + p[i:] | |
for p in permutations([1, 2, 3, 4]): | |
print p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define match(from, to, ptr, dir, level) \ | |
while(*(dir ptr)) { \ | |
if (*ptr == to && level == 0) break; \ | |
if (*ptr == from) ++level; \ | |
if (*ptr == to) --level; \ | |
} | |
char code[32768] = {0}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while true | |
do | |
cur_word=$(xclip -o | awk '{print $1}' | grep '^[a-zA-Z]\+$') | |
if [[ $last_word == $cur_word || -z $cur_word ]]; then | |
sleep 1 | |
continue | |
fi | |
word=$cur_word | |
result=$(parse.py $word) |