Skip to content

Instantly share code, notes, and snippets.

View liuyigh's full-sized avatar

Yi Liu liuyigh

View GitHub Profile
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<!-- Default system-ui fonts -->
<match target="pattern">
<test name="family">
<string>system-ui</string>
</test>
<edit name="family" mode="prepend" binding="strong">
@liuyigh
liuyigh / logging_to_str.py
Created February 21, 2019 00:24 — forked from 66Ton99/logging_to_str.py
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)
@liuyigh
liuyigh / nginx.conf
Last active December 15, 2018 04:28 — forked from QROkes/nginx.conf
NGINX Configuration for WordPress Multisite + Domain Mapping with HTTPS
#sudo certbot certonly --webroot -w /srv/users/serverpilot/apps/pkubio/public -d pkubio.org -d www.pkubio.org -d shalongla.com -d www.shalongla.com -d lishengshi.com -d www.lishengshi.com
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 {
@liuyigh
liuyigh / -
Created September 11, 2017 23:06 — forked from jedisct1/-
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
@liuyigh
liuyigh / wp_helper.sh
Last active February 21, 2020 19:58 — forked from phlbnks/wp_helper.sh
Utility script to help manage WordPress sites on an Serverpilot server (but not limited to SP)
#!/bin/bash
# Help / usage info.
USAGE=$'WordPress Helper script, adapted from Phil Banks (emirpprime@github) EasyEngine script for Serverpilot .\nWithout any args it will search /srv/users/serverpilot/apps for WordPress sites, loop over them in alphabetical order and check for core and plugin updates.\nAlso accepts:\n\t--sites=[space seperated list of site paths relative to /srv/users/serverpilot/apps]\n\t--update=[plugins|wp|all].'
# Die function for exiting on errors.
die () {
echo "${1}, exitting..." >&2 ; echo ; exit 1
}
@liuyigh
liuyigh / history_vol.py
Last active October 2, 2015 16:41 — forked from johntyree/history_vol.py
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')['Adj Close'][-days:]