Skip to content

Instantly share code, notes, and snippets.

View liuyigh's full-sized avatar

Yi Liu liuyigh

View GitHub Profile
@cunnie
cunnie / f1-micro-vs-g1-small.txt
Created August 31, 2016 22:13
g1-small is 2x faster than f1-micro
Compiling package 's3cli/1c5a91f02feff8a0e3a506ac51c4a3140e86f049'... Finished (00:00:04)
Compiling package 'ruby/589d4b05b422ac6c92ee7094fc2a402db1f2d731'... Finished (00:08:39)
Compiling package 'mysql/b7e73acc0bfe05f1c6cbfd97bf92d39b0d3155d5'... Finished (00:02:11)
Compiling package 'libpq/09c8f60b87c9bd41b37b0f62159c9d77163f52b8'... Finished (00:01:18)
Compiling package 'golang/1ad977ce1c6fdbf21485a79567ef3d8d4d280110'... Finished (00:03:05)
Compiling package 'powerdns/256336d00b1689138490c385c03ad3a8f54b4a9e'... Finished (00:00:10)
Compiling package 'director/0f1b09ec6bb28ea13d2e919e71dd7ccd8ab49313'... Finished (00:06:14)
Compiling package 'nats/0155cf6be0305c9f98ba2e9e2503cd72da7c05c3'... Finished (00:01:04)
Compiling package 'registry/3aa0993cb8739fd4f5c6fc1e0da8e1cfdf6df247'... Finished (00:06:20)
Compiling package 'bosh-google-cpi/22b47cafcd455cb8f94e164e2049a4976f4dce1c'... Finished (00:02:48)
@BuhtigithuB
BuhtigithuB / update_web2py_specific_files_inside_your_app.sh
Last active January 17, 2018 23:15
Update web2py specific files inside your app
# When you upgrade web2py your should update app files that are important to web2py for properly functioning
#
# views/
# appadmin.html
# generic.ics
# generic.load
# generic.rss
# layout.html
# generic.json
# generic.map
#!/usr/bin/env python
"""Test functions from
http://stackoverflow.com/questions/28680896/how-can-i-get-the-3rd-friday-of-a-month-in-python
"""
import calendar
from datetime import date, datetime, time, timedelta
from itertools import islice
DAY = timedelta(1)
@aenain
aenain / export-wunderlist-indexeddb.js
Created June 18, 2019 20:16
Wunderlist to Dynalist export. Go to Wunderlist web interface, backup data (JSON file), folders, list positions (from IndexedDB), use this script and import the output into Dynalist. Heavily inspired by https://gist.github.com/bryanph/fcddf602d60d7c6ecdaf6584f2db55a5
var download = (filename, text) => {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
@johntyree
johntyree / history_vol.py
Last active February 26, 2020 04:24
Calculate annualized volatility from historical data.
#/usr/bin/env python
from pandas import np
from pandas.io.data import DataReader
def historical_volatility(sym, days):
"Return the annualized stddev of daily log returns of `sym`."
try:
quotes = DataReader(sym, 'yahoo')['Close'][-days:]
@jedisct1
jedisct1 / -
Created May 11, 2016 09:24
Make top look less ugly on Arch Linux
remove your ~/.toprc (if any)
start "top"
press z
press V
press 1
press y
press m m
press t t t
press W
@dougalcampbell
dougalcampbell / NeoPixelTest.ino
Created October 31, 2013 03:29
Example of driving an Adafruit NeoPixel Ring with the Digispark Arduino-compatible board
#include <Adafruit_NeoPixel.h>
#define PIN 1
#define STRIPSIZE 16
// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
@66Ton99
66Ton99 / logging_to_str.py
Created August 28, 2015 16:26
Capturing Python Log Output In A Variable
import logging
from StringIO import StringIO as StringBuffer
logger = logging.getLogger('basic_logger')
logger.setLevel(logging.DEBUG)
### Setup the console handler with a StringIO object
log_capture_string = StringBuffer()
# log_capture_string.encoding = 'cp1251'
ch = logging.StreamHandler(log_capture_string)
@denvazh
denvazh / README.md
Last active March 17, 2023 16:38
Scheduled update for homebrew

Scheduled updates for homebrew

This two launchdaemon scripts provide scheduled updates and upgrade for homebrew packages.

It will run in the following way:

  • brew update every day at 12:10
  • brew upgrade every day at 12:20

How to install

@QROkes
QROkes / nginx.conf
Last active September 26, 2023 16:41
NGINX Configuration for WordPress Multisite + Domain Mapping with HTTPS
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com subsite.com www.subsite.com another.com www.another.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;