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
| import os | |
| import commands | |
| import time | |
| def get_process(): | |
| procs = set() | |
| for line in commands.getoutput("ps aux").split('\n'): | |
| if not line: # or '%CPU' in line: | |
| continue | |
| proc = ' '.join(line.split()[10:]) |
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
| struct HashSet<T : Hashable> { | |
| typealias Element = T | |
| var _map: Dictionary<T, ()> = [:] | |
| var count: Int { | |
| return _map.count | |
| } | |
| var isEmpty: Bool { |
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
| import Foundation | |
| //let raw = String.stringWithContentsOfURL(NSURL(string: "http://www.weather.com.cn/data/sk/101010100.html")) | |
| struct EasyJSON { | |
| var _obj: AnyObject! | |
| init(_ obj: AnyObject) { | |
| //assert(NSJSONSerialization.isValidJSONObject(obj), "must be valid json object") | |
| _obj = obj |
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 python | |
| # -*- coding: utf-8 -*- | |
| import operator | |
| import itertools | |
| import re | |
| def debug(x): | |
| print 'debug', dir(x), x.group() |
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 python | |
| # -*- coding: utf-8 -*- | |
| # FileName : cstruct.py | |
| # Author : Feather.et.ELF <andelf@gmail.com> | |
| # Created : Tue Feb 28 23:06:44 2012 by Feather.et.ELF | |
| # Copyright : Feather Workshop (c) 2012 | |
| # Description : mcpack v1 v2 | |
| # Time-stamp: <2012-03-31 18:58:42 andelf> | |
| import struct |
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
| ;; FileName : racer-autocomplete.el | |
| ;; Author : ShuYu Wang <andelf@gmail.com> | |
| ;; Created : Wed May 20 10:08:03 2015 by ShuYu Wang | |
| ;; Copyright : Feather Workshop (c) 2015 | |
| ;; Description : racer auto-complete source | |
| ;; Time-stamp: <2015-05-20 10:08:18 andelf> | |
| ;;; copy this to your load-path and add following to your ~/.emacs | |
| ;; (setq racer-cmd "/your/path/to/bin/racer") |
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
| #设置终端颜色为256色 | |
| set -g default-terminal "screen-256color" | |
| # auto resize to smallest windows size | |
| setw -g aggressive-resize on | |
| # Terminal emulator window titles | |
| set -g set-titles on | |
| set -g set-titles-string "#T" | |
| #将激活控制台的快捷键由Ctrl+b修改为Ctrl+z |
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
| %%%------------------------------------------------------------------- | |
| %%% @author <andelf@gmail.com> | |
| %%% @copyright (C) 2013, | |
| %%% @doc | |
| %%% | |
| %%% @end | |
| %%% Created : 18 Apr 2013 by <andelf@gmail.com> | |
| %%%------------------------------------------------------------------- | |
| -module(dns_proxy_srv). |
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
| :set prompt "λ> " | |
| :set +t |
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
| function MONAD(modifier) { | |
| var prototype = Object.create(null); | |
| function unit(value) { | |
| var monad = Object.create(prototype); | |
| monad.bind = function (func, args) { | |
| return func.apply(undefined, | |
| [value].concat(Array.prototype.slice.apply(args || []))); | |
| }; | |
| if (typeof modifier == 'function') { | |
| monad = modifier(monad, value); |
OlderNewer