code
def calc(ns, g):
ns.sort() # sort list o(nlg(n))
ds = []
for i in range(len(ns)-1): # o(n)
ds.append(ns[i+1]-ns[i])final TelephonyManager tm = (TelephonyManager)
getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);
final String tmDevice, tmSerial, androidId;
tmDevice = "" + tm.getDeviceId();
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
| # suppose ls -l will show content like below | |
| # drwxr-xr-x 8 yangb staff 272 Apr 17 16:21 output | |
| # -rw-r--r-- 1 yangb staff 13925 Apr 17 15:15 post.py | |
| ls -l | awk '{print $9}' | xargs du -sh |
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
| sed need one more parameter | |
| bash_profile will be loaded, not profile or bashrc | |
| PS1 need export | |
| function parse_git_branch() { | |
| branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) | |
| if [[ -z "$branch" ]]; then return; fi | |
| if [[ -z "$(git status -s 2>/dev/null)" ]]; then |
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
| #!/usr/bin/env ruby | |
| require 'colorize' | |
| require 'optparse' | |
| class LOLCat | |
| def initialize options = {} | |
| @tagspecs = options[:tagspecs] || [] | |
| @whitelist = options[:processes] || [] | |
| @processes = Hash.new | |
| end |