Skip to content

Instantly share code, notes, and snippets.

Yifei Kong yifeikong

Block or report user

Report or block yifeikong

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View boost glob
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
struct recursive_directory_range
{
typedef fs::recursive_directory_iterator iterator;
recursive_directory_range(fs::path p) : p_(p) {}
@yifeikong
yifeikong / GM_XHR.js
Created Feb 18, 2017 — forked from monperrus/GM_XHR.js
allows using all Jquery AJAX methods in Greasemonkey
View GM_XHR.js
// allows using all Jquery AJAX methods in Greasemonkey
// inspired from http://ryangreenberg.com/archives/2010/03/greasemonkey_jquery.php
// works with JQuery 1.5
// (c) 2011 Martin Monperrus
// (c) 2010 Ryan Greenberg
//
// Usage:
// $.ajax({
// url: '/p/',
// xhr: function(){return new GM_XHR();},
View AndroidManifext.xml
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
View genesis_public_key
0402fc0c2fd7657f1c9a118fd2568b6e35cd0c5d7fac901f4dfa7d3ca6c83aeae03ce7bc694cf183eb1c9b09af88edaddeb0b90b892cbcd18a1a1990fa6ec671ac
View ascii2unicode.py
#!/usr/bin/env python
#coding: utf-8
import sys
import json
ascii_json = sys.stdin.read().decode('utf-8')
json_obj = json.loads(ascii_json)
print(json.dumps(json_obj, ensure_ascii=False, indent=4, encoding='utf-8'))
View test_spaces.py
<title>There are more than one spaces " "</title>
<h1>h1: There are more than one spaces " "</h1>
<p>p: There are more than one spaces " "</p>
<pre>pre: There are more than one spaces " "</pre>
@yifeikong
yifeikong / remove_emoji.py
Created Feb 22, 2018
remove emoji in python
View remove_emoji.py
#!/usr/bin/env python
# coding: utf-8
import re
text = u'This dog \U0001f602'
print(text) # with emoji
def remove_emoji(data):
if not data:
View tmux_session.sh
#!/usr/bin/env bash
# Save and restore the state of tmux sessions and windows.
# TODO: persist and restore the state & position of panes.
set -e
dump() {
local d=$'\t'
tmux list-windows -a -F "#S${d}#W${d}#{pane_current_path}"
}
View get_bucket.lua
if not redis.pcall('exists', KEYS[1]) then
return 1
end
local bucket_name = KEYS[1]
local current_time = ARGV[1]
-- bucket {rate, timespan, last_check, tokens}
local rate = redis.pcall('hget', bucket_name, 'rate')
local timespan = redis.pcall('hget', bucket_name, 'timespan')
View android-x-compile-init-mac.sh
#!/bin/bash
brew install android-ndk
export NDK_VERSION='r13'
export NDK=/usr/local/Cellar/android-ndk
export GCC_VERSION='4.9'
export ANDROID_VERSION='21' # android 5.0
export ARCH='arm'
export PATH=$PATH:$NDK/$NDK_VERSION/toolchains/$ARCH-linux-androideabi-$GCC_VERSION/prebuilt/darwin-x86_64/bin
You can’t perform that action at this time.