Skip to content

Instantly share code, notes, and snippets.

View waynehuang13's full-sized avatar

Wayne Huang waynehuang13

  • San Francisco
View GitHub Profile
### Keybase proof
I hereby claim:
* I am waynehuang13 on github.
* I am whuang1220 (https://keybase.io/whuang1220) on keybase.
* I have a public key ASDuwWJ4kcTDU7H-x1W5jzXI1kDf0Ju9EmKPRyZ-CTDUNwo
To claim this, I am signing this object:
@waynehuang13
waynehuang13 / IPTV.m3u8
Last active May 7, 2022 01:32
IPTV.m3u8
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/af/arianaafgtv.com.epg.xml,https://iptv-org.github.io/epg/guides/ar/mi.tv.epg.xml,https://iptv-org.github.io/epg/guides/at/magentatv.at.epg.xml,https://iptv-org.github.io/epg/guides/bf/canalplus-afrique.com.epg.xml,https://iptv-org.github.io/epg/guides/bo/comteco.com.bo.epg.xml,https://iptv-org.github.io/epg/guides/bs/rev.bs.epg.xml,https://iptv-org.github.io/epg/guides/co/mi.tv.epg.xml,https://iptv-org.github.io/epg/guides/cz/m.tv.sms.cz.epg.xml,https://iptv-org.github.io/epg/guides/dk/allente.se.epg.xml,https://iptv-org.github.io/epg/guides/gr/cosmote.gr.epg.xml,https://iptv-org.github.io/epg/guides/in/dishtv.in.epg.xml,https://iptv-org.github.io/epg/guides/it/guidatv.sky.it.epg.xml,https://iptv-org.github.io/epg/guides/my/astro.com.my.epg.xml,https://iptv-org.github.io/epg/guides/nl/delta.nl.epg.xml,https://iptv-org.github.io/epg/guides/ph/clickthecity.com.epg.xml,https://iptv-org.github.io/epg/guides/pl/programtv.onet.pl.epg.xml,https://iptv-org.git

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@waynehuang13
waynehuang13 / recover_source_code.md
Created March 12, 2017 08:01 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@waynehuang13
waynehuang13 / comprehensions.md
Created March 28, 2016 07:48 — forked from bearfrieze/comprehensions.md
Comprehensions in Python the Jedi way

Comprehensions in Python the Jedi way

Beautiful is better than ugly. Explicit is better than implicit.

-- The Zen of Python

I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.

All of the tasks presented in the examples can be accomplished with the extensive standard library available in Python. These solutions would arguably be more terse and efficient in some cases. I don't have anything against the standard library. To me there is a certain

@waynehuang13
waynehuang13 / cmdbuild.sh
Created February 3, 2016 18:47 — forked from sinofool/cmdbuild.sh
A script to override xcode project configurations
#!/bin/bash
set -x
USAGE() {
cat << EOF
Usage: ${0##*/} <-i ident.p12> [-p password] <-m profile.mobileprovision> [-a com.example.app] [-n NewName] [-I Info.plist]
-i ident.p12 The signing identity file.
-p password The password of signing identity file.
-m profile.mobileprovision Signing provision profile
-a com.example.app Override CFBundleIdentifier
@waynehuang13
waynehuang13 / gist:e7175423f638bc44edd3
Last active August 29, 2015 14:24 — forked from newhouseb/gist:1620133
postgresql alter tables
The basic idea here is to substantiate the claims made by this square post:
http://corner.squareup.com/2011/06/postgresql-data-is-important.html
In PostgreSQL, and MySQL (MyISAM and InnoDB) I create millions of rows and then add
and remove columns and add and remove indexes. For columns without defaults this is
basically free in PostgreSQL and O(n) in MySQL. For adding indexes its at best O(n)
everywhere, but with PostgreSQL it claims not to do any locking that would otherwise
prevent table interaction.
Also, PostgreSQL has _awsome_ documentation (it has real examples!). I always get
# LBs have 8 cores. One is used for haproxy, rest are used for nginx workers
worker_processes 7;
worker_rlimit_nofile 90000;
pid <PID_FILE>;
events {
use epoll;
multi_accept off;
accept_mutex off;
# gem 'activerecord', '4.1.1' # passes
gem 'activerecord', '4.1.2.rc1' # fails with ActiveModel::MassAssignmentSecurity::Error: Can't mass-assign protected attributes for Membership: group_id
gem 'protected_attributes', '1.0.7'
require 'active_record'
require 'minitest/autorun'
require 'logger'
require 'protected_attributes'
# Ensure backward compatibility with Minitest 4
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
# inspired by http://ariejan.net/2010/08/23/resque-how-to-requeue-failed-jobs
# retry all failed Resque jobs except the ones that have already been retried
# This is, for instance, useful if you have already retried some jobs via the web interface.
Resque::Failure.count.times do |i|
Resque::Failure.requeue(i) unless Resque::Failure.all(i, 1)['retried_at'].present?
end
# retry all :)
Resque::Failure.count.times do |i|