Skip to content

Instantly share code, notes, and snippets.

George Song gsong

Block or report user

Report or block gsong

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
@gsong
gsong / nyt_where_to_go_2018.py
Created Jan 14, 2018
Parse NYT where to go list
View nyt_where_to_go_2018.py
#!/usr/bin/env python
import csv
import json
import re
from collections import OrderedDict
from urllib.parse import quote
import attr
import click
@gsong
gsong / pyenv-setup.md
Last active Sep 11, 2018
Pyenv Setup Step-by-step
View pyenv-setup.md
  1. Install [pyenv][] using [pyenv-installer][]:

    curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
  2. Activate pyenv for Terminal:

    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
@gsong
gsong / brew-config.log
Last active May 7, 2017
`brew install highlight` error
View brew-config.log
HOMEBREW_VERSION: 1.2.0-50-g3e4547f5
ORIGIN: https://github.com/Homebrew/brew
HEAD: 3e4547f52e7ebec633f8bfefc8a396d944edf908
Last commit: 52 minutes ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 9c4f788f512c3fdb9f83dace59b2194a778c13bd
Core tap last commit: 12 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
@gsong
gsong / gifting
Last active Dec 11, 2016
Christmas gift exchange
View gifting
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from random import sample
# people grouped together cannot gift to each other
people = [
('Sue', 'Sam'),
('Heather', 'Matt'),
('Noelle', 'George'),
@gsong
gsong / epo_ops_test.py
Last active Aug 29, 2015
Test to validate python-epo-ops-client
View epo_ops_test.py
import platform
import epo_ops
registered_client = epo_ops.RegisteredClient(
key='h07O7iAKj3stHFjGCAZSgFhPHIwDmTqE',
secret='QjzSphsngYD55em0'
)
@gsong
gsong / tm-last-backup.py
Last active Dec 26, 2015
Python script to return the last successful Time Machine backup timestamp.
View tm-last-backup.py
#!/usr/bin/env python
from datetime import timedelta, tzinfo
from shlex import split
from subprocess import Popen, PIPE
import os
import plistlib
ZERO = timedelta(0)
NOT_ENABLED = u'Not enabled.'
View gistcheck.py
# Source: https://gist.github.com/4702275
#
# All-purpose gist tool for Pythonista.
#
# When run directly, this script sets up four other scripts that call various
# functions within this file. Each of these sub-scripts are meant for use as
# action menu items. They are:
#
# Set Gist ID.py - Set the gist id that the current file should be
# associated with.
@gsong
gsong / ThreadedSceneDemo.py
Last active Dec 21, 2015
Pythonista demo of a single worker thread which polls a website for updates and displays the result in `Scene.draw`.
View ThreadedSceneDemo.py
from datetime import datetime
import Queue
import re
import threading
import urllib2
from scene import *
OUTPUT_TEMPLATE = u"""\
Number of threads: {}
@gsong
gsong / gist:6321633
Last active Jun 14, 2019
Bash script to generate SSL csr/key/crt
View gist:6321633
#!/bin/bash
# Usage:
#
# ssl_setup [--self] <name> <csr_config>
#
# This script is used to generate key and CSR for use HTTPS in Nginx.
#
# --self Generate self-signed certificate in addition to key and CSR.
# name Output files will be named as <name>.key and <name>.csr.
@gsong
gsong / net.damacy.releasemem.plist
Created Mar 17, 2012
LaunchAgent to release inactive memory on OS X 10.7
View net.damacy.releasemem.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.damacy.releasemem</string>
<key>ProgramArguments</key>
<array>
<string>/Users/george/.bin/releasemem.py</string>
</array>
You can’t perform that action at this time.