Skip to content

Instantly share code, notes, and snippets.

View imZack's full-sized avatar
🤠
Make bugs

YuLun Shih imZack

🤠
Make bugs
  • Moxa
  • Taipei, Taiwan
View GitHub Profile
@imZack
imZack / README.md
Created April 19, 2014 16:41 — forked from oodavid/README.md

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
# -*- coding: utf-8 -*-
"""
This script will delete all of the tweets in the specified account.
You may need to hit the "more" button on the bottom of your twitter profile
page every now and then as the script runs, this is due to a bug in twitter.
You will need to get a consumer key and consumer secret token to use this
script, you can do so by registering a twitter application at https://dev.twitter.com/apps
@requirements: Python 2.5+, Tweepy (http://pypi.python.org/pypi/tweepy/1.7.1)
@imZack
imZack / find_dunplicate
Last active August 29, 2015 14:04
This script will finds sanji.log's duplicate line.
from sets import Set
import collections
lines = []
with open('/tmp/sanji.log', 'r') as f:
lines = f.readlines()
boots = list()
bufferLines = list()
for line in lines:
@imZack
imZack / introrx.md
Last active August 29, 2015 14:06 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import logging
from time import sleep
from datetime import datetime
from sanji.core import Sanji
from sanji.connection.mqtt import Mqtt
@imZack
imZack / ezshell.py
Created December 31, 2014 09:55
subprocess in thread
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
import subprocess
import threading
import os
import signal
# The utility is run in a fake environment, do no apply any operation that may
# change your system configuration
# -*- coding: utf-8 -*-
"""
This script will delete all of the tweets in the specified account.
You may need to hit the "more" button on the bottom of your twitter profile
page every now and then as the script runs, this is due to a bug in twitter.
You will need to get a consumer key and consumer secret token to use this
script, you can do so by registering a twitter application at https://dev.twitter.com/apps
@requirements: Python 2.5+, Tweepy (http://pypi.python.org/pypi/tweepy/1.7.1)
@imZack
imZack / Makefile
Last active August 29, 2015 14:18 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@imZack
imZack / preprocessor_fun.h
Last active August 29, 2015 14:27 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@imZack
imZack / benchmark.sh
Created September 5, 2015 08:50
benchmark io speed
#!/bin/sh
sync
echo 3 > /proc/sys/vm/drop_caches
dd if=/dev/zero of=/test bs=8k count=100k