Skip to content

Instantly share code, notes, and snippets.

@andelf
andelf / Swift.text
Created June 20, 2014 08:51
Swift Standard Library .swiftmodule Dump
Swift
LLVM 3.5svn
/SourceCache/compiler_KLONDIKE/compiler_KLONDIKE-600.0.34.4.8/src/tools/swift/stdlib/core/Algorithm.swift
/SourceCache/compiler_KLONDIKE/compiler_KLONDIKE-600.0.34.4.8/src/tools/swift/stdlib/core/ArrayBody.swift
/SourceCache/compiler_KLONDIKE/compiler_KLONDIKE-600.0.34.4.8/src/tools/swift/stdlib/core/ArrayBuffer.swift
/SourceCache/compiler_KLONDIKE/compiler_KLONDIKE-600.0.34.4.8/src/tools/swift/stdlib/core/ArrayBufferType.swift
/SourceCache/compiler_KLONDIKE/compiler_KLONDIKE-600.0.34.4.8/src/tools/swift/stdlib/core/ArrayType.swift
/BinaryCache/compiler_KLONDIKE/compiler_KLONDIKE-600.0.34.4.8~2/Objects/stdlib/macosx-10.9-internal-x86_64/stdlib/core/Arrays.swift
/SourceCache/compiler_KLONDIKE/compiler_KLONDIKE-600.0.34.4.8/src/tools/swift/stdlib/core/Assert.swift
/SourceCache/compiler_KLONDIKE/compiler_KLONDIKE-600.0.34.4.8/src/tools/swift/stdlib/core/AssertCommon.swift
@andelf
andelf / Monad.swift
Last active February 18, 2017 00:29
Monad in Swift
// Monad
operator infix >>= {
precedence 10
associativity left
}
struct _MReturn {
}
@transparent func _mreturn<Args>(a: Args) -> (_MReturn, Args) {
return (_MReturn(), a)
@andelf
andelf / EasyJSON.swift
Last active August 29, 2015 14:03
Swift JSON Helper
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
@andelf
andelf / Optional-ext.swift
Last active November 21, 2018 19:55
Swift Optional Extension
protocol Index {
typealias IndexType
typealias Result
subscript (i: IndexType) -> Result { get }
}
protocol IndexMut: Index {
typealias IndexType
typealias Result
@andelf
andelf / racer-auto-complete.el
Last active October 4, 2015 03:13
Racer Auto-Complete Mode
;; 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")
@andelf
andelf / install_swift_snapshot_to.sh
Created April 28, 2016 04:23
Swift Development Snapshot Install Script
#!/bin/sh
# FileName : install_swift_to.sh
# Author : ShuYu Wang <andelf@gmail.com>
# Created : Thu Apr 28 12:21:46 2016 by ShuYu Wang
# Copyright : Feather Workshop (c) 2016
# Description : Swift Snapshot Installing Script
# Time-stamp: <2016-04-28 12:22:51 andelf>
OLDPWD=$(pwd)
@andelf
andelf / wait_for_pid.py
Created December 27, 2016 12:38
Ansible task: wait for pid and threads
#!/usr/bin/python
# -*- coding: utf-8 -*-
import binascii
import datetime
import math
import re
import select
import socket
import sys
@andelf
andelf / django_fix_timezone.py
Created November 9, 2019 10:42
fix wrong django timezone
import sys
import os.path
from datetime import datetime, timedelta
from pprint import pprint
import pytz
__dir__ = os.path.dirname(__file__)
__proj_dir__ = os.path.dirname(__dir__)
sys.path.insert(0, __proj_dir__)
@andelf
andelf / .tmux.conf
Created January 21, 2020 09:34
.tmux.conf
#设置终端颜色为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
@andelf
andelf / split-transaction-raw.py
Created February 24, 2020 11:07
Split Raw transaction
# define P1_FIRST 0x00
# define P1_MORE 0x80
# define P1_LAST 0x90
from google.protobuf.internal.decoder import _DecodeVarint32
from base import parse_bip32_path