Skip to content

Instantly share code, notes, and snippets.

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" /v 29 /d "%systemroot%\system32\imageres.dll,197" /t reg_sz /f
taskkill /f /im explorer.exe
attrib -s -r -h "%userprofile%\AppData\Local\iconcache.db"
del "%userprofile%\AppData\Local\iconcache.db" /f /q
start explorer
@johnsmith17th
johnsmith17th / Apache2.txt
Created May 27, 2013 06:06
Software Licenses
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
@johnsmith17th
johnsmith17th / fml_extract.py
Created May 27, 2013 05:37
Extract data from fml text
# -*- coding: utf-8 -*-
import codecs
sql = 'insert into fml(id, author, gender, address, content, date) values(%s, \'%s\', \'%s\', \'%s\', \'%s\', \'%s\');\n'
def getPrefix(tx):
return tx[tx.rfind('-') + 1: tx.rfind('.')]
def getDate(tx):
return tx[tx.rfind('/') + 1:tx.rfind('-')].replace('-', '/')
@johnsmith17th
johnsmith17th / base.py
Created May 27, 2013 05:30
Text Classifiers
'''
@author: John Smith
'''
class Classifier(object):
''' base classifier '''
def __init__(self, **kwargs):
pass
@johnsmith17th
johnsmith17th / scws.py
Created May 27, 2013 05:19
scws segment
import urllib, urllib2, json
def seg(text):
data = { 'data': text, 'respond': 'json', 'charset': 'utf-8', 'ignore': 'yes', 'multi': 3 }
parm = urllib.urlencode(data)
post = urllib2.urlopen(url = 'http://www.ftphp.com/scws/api.php', data = parm, timeout = 10000)
response = post.read()
data = json.loads(response)
return [i['word'] for i in data['words']]
@johnsmith17th
johnsmith17th / md5.py
Created May 27, 2013 05:17
make md5 in python
from hashlib import md5
def digest(text):
h = md5()
h.update(text.encode('utf-8'))
return h.hexdigest().upper()
#!/usr/bin/env python
#coding=utf-8
import sys, math, random
import numpy
import operator
from abstract_classifier import Classifier
def shuffle(ary):
@johnsmith17th
johnsmith17th / bpnn.py
Created May 27, 2013 03:15
Back-Propagation Neural Networks by Neil Schemenauer
# Back-Propagation Neural Networks
#
# Written in Python. See http://www.python.org/
# Placed in the public domain.
# Neil Schemenauer <nas@arctrix.com>
import math
import random
import string
@johnsmith17th
johnsmith17th / sorting.js
Created April 30, 2013 14:18
Get sorting of query.
/**
* Get sorting of query.
*
* @param {HttpRequest} req
* @param {Object} options
* - {Boolean} [customizable]
* whether the sorting is customizable
* i.e. can be pass from query string with the key $sort
* e.g. $sort=id,-key
* - {String} [defaults]
@johnsmith17th
johnsmith17th / filter.js
Last active December 16, 2015 19:59
Get filters of query.
/**
* Get filters of query.
*
* @param {HttpRequest} req
* @param {Object} [options]
* - {Boolean} [customizable]
* whether the filter is customizable
* i.e. can be pass from query string with the key $filter
* e.g. $filter=id,key,value
* - {Object} [allow]