Skip to content

Instantly share code, notes, and snippets.

View badbye's full-sized avatar
Dreaming

yalei badbye

Dreaming
  • China
View GitHub Profile
@badbye
badbye / zsh_config.sh
Last active September 16, 2017 04:21
Script for configure oh-my-zsh & imgcat & autojump, support ubuntu and centos.
# 0. system: ubuntu or centos?
if [ $UID -ne 0 ]
then
echo "Error: must be root to run this script."
exit -1
fi
is_ubuntu=(` cat /etc/issue | grep -i ubuntu `)
password=$1
# 1. zsh
@badbye
badbye / fulanhua.py
Created August 17, 2017 06:00
普通话 转 弗兰话(湖南话)
# encoding: utf8
"""
Created on 2017.08.17
@author: yalei
"""
from __future__ import unicode_literals
@badbye
badbye / HorseRun.java
Created July 6, 2017 23:52
Horse Run: The shortest path from one start point to the end point.
import edu.princeton.cs.algs4.MinPQ;
import edu.princeton.cs.algs4.Stack;
import edu.princeton.cs.algs4.StdIn;
import edu.princeton.cs.algs4.StdOut;
public class HorseRun{
private int n = 10;
private int count;
private Stack<Point> road;
@badbye
badbye / check_email.py
Last active July 8, 2020 09:32
Check the validation of an email
# encoding: utf8
"""
Created on 2017.06.27
@author: yalei
Reference:
1. http://www.ruanyifeng.com/blog/2017/06/smtp-protocol.html
2. http://blog.online-domain-tools.com/2014/11/14/how-to-verify-email-address/
@badbye
badbye / benchmark.R
Created June 2, 2017 16:28
Benchmark of R's http framework
microbenchmark:::microbenchmark(system('curl http://127.0.0.1:9123/predict?val=190'))
microbenchmark:::microbenchmark(system('curl http://127.0.0.1:9124/predict?val=190'))
@badbye
badbye / hmm.py
Created March 7, 2017 03:10
HMM中文分词
# encoding: utf8
"""
Created on 2017.03.06
@author: yalei
"""
import itertools
@badbye
badbye / better_test_arg.py
Created January 21, 2017 12:24
Elegent magic
# encoding: utf8
"""
Created on 2017.01.21
@author: yalei
"""
import inspect
import re
@badbye
badbye / test_arg.py
Created January 21, 2017 12:07
Magic: extract arguments from function
# encoding: utf8
"""
Created on 2017.01.21
@author: yalei
"""
import sys
import traceback
@badbye
badbye / scope.py
Created January 6, 2017 06:25
how `local()` works?
>>> def f():
... a = 1
... locals()['a'] = 123
... print locals()
...
>>> f()
{'a': 1}
>>> def f():
... locals()['a'] = 123
... print locals()
@badbye
badbye / genymotionwithplay.txt
Created December 12, 2016 15:42 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)