Skip to content

Instantly share code, notes, and snippets.

Yi Liu liuyigh

Block or report user

Report or block liuyigh

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
liuyigh /
Created Feb 21, 2019 — forked from 66Ton99/
Capturing Python Log Output In A Variable
import logging
from StringIO import StringIO as StringBuffer
logger = logging.getLogger('basic_logger')
### Setup the console handler with a StringIO object
log_capture_string = StringBuffer()
# log_capture_string.encoding = 'cp1251'
ch = logging.StreamHandler(log_capture_string)
liuyigh / nginx.conf
Last active Dec 15, 2018 — forked from QROkes/nginx.conf
NGINX Configuration for WordPress Multisite + Domain Mapping with HTTPS
View nginx.conf
#sudo certbot certonly --webroot -w /srv/users/serverpilot/apps/pkubio/public -d -d -d -d -d -d
server {
listen 80;
listen [::]:80;
return 301 https://$host$request_uri;
server {
liuyigh / trialDB.csv
Last active Jun 14, 2018
Trialert: Notify You by eMail When Clinical Trial Updates
View trialDB.csv
index name ctID lastUpdate
0 DV281 NCT03326752 November 1, 2017
1 SD101 NCT02521870 December 7, 2017
2 AZD1419 NCT02898662 December 21, 2017
3 SD101+MK1966 NCT02731742 December 11, 2017
liuyigh / -
Created Sep 11, 2017 — forked from jedisct1/-
Make top look less ugly on Arch Linux
View -
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 / iPyNbViewer_v3.applescript
Last active Dec 13, 2018
iPyNbViewer: Standalone App for IPython Notebook (v3; latest)
View iPyNbViewer_v3.applescript
on open this_item
tell application "Finder"
set pathList to (quoted form of POSIX path of (folder of the front window as alias))
set command to "clear; cd " & pathList
end tell
tell application "System Events"
-- some versions might identify as "iTerm2" instead of "iTerm"
set isRunning to (exists (processes where name is "iTerm")) or (exists (processes where name is "iTerm2"))
liuyigh / iPyNbViewer_v2.applescript
Created Sep 11, 2017
iPyNbViewer: Standalone App for IPython Notebook v2 (outdated; use v3 instead)
View iPyNbViewer_v2.applescript
on open this_item
tell application "iTerm"
set iPyNbViewer to (make new terminal)
tell iPyNbViewer
activate current session
launch session "Default Session"
tell the last session
set name to "IPython Notebook"
liuyigh / iPyTerm.applescript
Created Sep 11, 2017
iPyTerm - AppleScript Based iTerm2 launcher for IPython
View iPyTerm.applescript
on run {input, parameters}
-- Run ipython on a new iTerm (OS X version)
-- See
tell application "iTerm"
set ipy to (make new terminal)
liuyigh /
Last active Oct 23, 2017
On-demand back up WordPress to Google Drive with Bash Script. Adapted frpm for serverpilot server. Removed some scripts for automatic backup, such as old backup deletion, directory checking etc.
#!/usr/bin/env bash
# Source:
# Author: Mike
#define local path for backups
#define remote backup path
liuyigh /
Last active Sep 9, 2017
Automatically Back up WordPress to Google Drive with Bash Script. Adapted frpm for serverpilot server.
#!/usr/bin/env bash
# Source:
# Author: Mike
# Editted by Yi Liu (
# Changes: packup path, site path, use find wp-admin to skip non-wp apps, removed permission lines.
# Run this as user serverpilot
#define local path for backups
liuyigh /
Last active Mar 3, 2019 — forked from emirpprime/
Utility script to help manage WordPress sites on an Serverpilot server (but not limited to SP)
# 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
You can’t perform that action at this time.