Skip to content

Instantly share code, notes, and snippets.

Asoul Yang Asoul

Block or report user

Report or block Asoul

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 .zshrc
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
# Execute function in prompt
# Enable color in prompt
Asoul /
Last active Sep 11, 2019
Bitfinex lending bot
import time
import base64
import json
import hmac
import hashlib
import requests
URL = ''
Asoul /
Created Jun 24, 2018 — forked from inactivist/
Simple decorator for flask and mongoengine/pymongo to auto-retry with delay on pymongo.errors.AutoReconnect exception in a view or other function
Simple view decorator for flask and mongoengine/pymongo to auto-retry with delay on
pymongo.errors.AutoReconnect exception.
from functools import wraps
import time
from pymongo.errors import AutoReconnect
import flask
Asoul /
Created Jun 5, 2018 — forked from syedrakib/
An example of asymmetric encryption in python using a public/private keypair - utilizes RSA from PyCrypto library
# Inspired from
# PyCrypto docs available at
from Crypto import Random
from Crypto.PublicKey import RSA
import base64
def generate_keys():
# RSA modulus length must be a multiple of 256 and >= 1024
modulus_length = 256*4 # use larger value in production
Asoul /
Created Dec 19, 2017 — forked from guyskk/
import flask
from flask import Flask
app = Flask(__name__)
def index():
return "hello"
View gist:1f5fefdc1ec9f7555593b75bc35b8e67
class KMP:
def partial(self, pattern):
""" Calculate partial match table: String -> [Int]"""
ret = [0]
for i in range(1, len(pattern)):
j = ret[i - 1]
while j > 0 and pattern[j] != pattern[i]:
j = ret[j - 1]
ret.append(j + 1 if pattern[j] == pattern[i] else j)
import requests
import time
endpoint = ''
targets = ['0050']
timestamp = int(time.time() * 1000 + 1000000)
channels = '|'.join('tse_{}.tw'.format(target) for target in targets)
query_url = '{}?_={}&ex_ch={}'.format(endpoint, timestamp, channels)
req = requests.session()
View shopify-custom-i18n.js
window.i18n = window.i18n || {};
i18n._langCache = {}
i18n._availableLangs = [
Asoul / style.less
Created Feb 17, 2017
Atom style, darken the invisible and guide lines
View style.less
* Your Stylesheet
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
* Add your own CSS or Less to fully customize Atom.
* If you are unfamiliar with Less, you can read more about it here:
You can’t perform that action at this time.