Skip to content

Instantly share code, notes, and snippets.

@niyaton
niyaton / msdn_keys_converter.py
Last active December 15, 2015 09:58
MSDNの大量のプロダクトキーをどうにかするアレ
import sys
from lxml import etree
from itertools import count, izip
if len(sys.argv) < 2:
print 'Usage: %s filename' % ( sys.argv[0] )
exit()
doc = etree.parse(sys.argv[1])
@niyaton
niyaton / import_ss_from_vnc.sh
Last active December 15, 2015 03:58
VNCのスクリーンショットを変化があった時だけ作成するスクリプト.cronに仕込んで使う.
#!/bin/bash -
new_filename=`date +\%Y\%m\%d\%H\%M\%S`.jpg
old_filename=`ls *.jpg | tail -n 1`
old_md5=`md5sum $old_filename | cut -d ' ' -f 1`
DISPLAY=":1.0" import -w root $new_filename
new_md5=`md5sum $new_filename | cut -d ' ' -f 1`
if [ $old_md5 = $new_md5 ]; then
rm $new_filename
fi
import itertools
import re
org_str = '2ABACBDEDFDFDFDCBACDAFB2'
candidates = ['0', '3', '4', '5', '6', '7', '8', '9']
operators = ['+', '-', '*', '/', '=']
candidates.extend(operators)
simple_op_check = re.compile(r'[*+-/=][*+-/=0]')