Skip to content

Instantly share code, notes, and snippets.

View hafei's full-sized avatar
:octocat:
Working from home

hafei hafei

:octocat:
Working from home
View GitHub Profile
@hafei
hafei / install.sh
Created May 17, 2020 06:42 — forked from chuyik/install.sh
Bandwagon(搬瓦工) CentOS 7 安装 shadowsocks-libev 和 kcptun
######################
## shadowsocks-libev
######################
# install dependencies
yum install epel-release -y
yum install gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto udns-devel libev-devel -y
# install shadowsocks-libev
cd /etc/yum.repos.d/
@hafei
hafei / check_digit.rb
Created May 21, 2019 09:25 — forked from stuartbain/check_digit.rb
Calculate check digits for SEDOL, CUSIP, ISIN and BBGID (Bloomberg Global Id) codes
module CheckDigit
class SEDOL
SEDOL_WEIGHTS = [1,3,1,7,3,9]
SEDOL_PATTERN = /[B-Db-dF-Hf-hJ-Nj-nP-Tp-tV-Xv-xYyZz\d]{6}/ # http://regexlib.com/REDetails.aspx?regexp_id=1044
def self.calculate(sedol)
raise 'Invalid pattern' unless sedol =~ SEDOL_PATTERN
@hafei
hafei / allitebooks.py
Created September 9, 2018 11:13
allitebooks crawl
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 23 23:32:36 2018
pyMongo API
https://api.mongodb.com/python/current/
@author: Sean
"""
@hafei
hafei / foxebook.net.py
Created September 8, 2018 08:04
foxbook crawl
"""
# -*- coding: utf-8 -*-
# http://www.foxebook.net/new-release/page/pagenum
@author: Sean
"""
@hafei
hafei / gist:5e772230fa4a1405c542df7ee1426295
Created August 30, 2018 13:42 — forked from vnsam/gist:187be13c408b291f9b9c0a28c72fb7ff
Pro version key for Beyond Compare - v4.2.3.22587
This can be used in Mac by using following trick:
Open trial.key at path: /Applications/Beyond\ Compare.app/Contents/Resources/trial.key
Replace content of trial.key with:
--- BEGIN LICENSE KEY ---
H1bJTd2SauPv5Garuaq0Ig43uqq5NJOEw94wxdZTpU-pFB9GmyPk677gJ
vC1Ro6sbAvKR4pVwtxdCfuoZDb6hJ5bVQKqlfihJfSYZt-xVrVU27+0Ja
hFbqTmYskatMTgPyjvv99CF2Te8ec+Ys2SPxyZAF0YwOCNOWmsyqN5y9t
q2Kw2pjoiDs5gIH-uw5U49JzOB6otS7kThBJE-H9A76u4uUvR8DKb+VcB
rWu5qSJGEnbsXNfJdq5L2D8QgRdV-sXHp2A-7j1X2n4WIISvU1V9koIyS
@hafei
hafei / Backup_MongoDB.ps1
Created August 16, 2018 03:42 — forked from stefanwalther/Backup_MongoDB.ps1
Powershell to backup all local MongoDB databases
$date = Get-Date -UFormat %Y-%m-%d;
$backupFolder = $date;
$basePath = "C:\bla";
$destinationPath = Join-Path $basePath $backupFolder;
if(!(Test-Path -Path $destinationPath)) {
New-Item -ItemType directory -Path $destinationPath;
(C:\mongodb\bin\mongodump.exe --out $destinationPath);
}
@hafei
hafei / sql-server-export.ps1
Created August 6, 2018 05:45 — forked from kerin/sql-server-export.ps1
powershell script for exporting SQL Server DBs as CSV files
$server = "IE11WIN7\SQLEXPRESS"
$tablequery = "SELECT name from sys.tables"
$databases = @(
"AdjudicationPanel",
"Ossc",
"Osscahmlr",
"ASADJ",
"CARESTANDARDS",
"CICAP",
@hafei
hafei / git_proxy_socks5.sh
Created March 4, 2018 06:19 — forked from bluethon/git_proxy_socks5.sh
设置git使用socks5代理
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
// 方法一:string
function multiChar(str) {
if (typeof str !== 'string') {
return '';
}
var obj = {},
num = 0,
value = '',
ch = '';
import urllib.request
import re
import datetime
from datetime import timedelta
import ctypes
import winsound
def search(fromDate,toDate):
found = False
while not found: