Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View pa4373's full-sized avatar

Wei-Shao Tang (Frank Tang) pa4373

View GitHub Profile
@pa4373
pa4373 / bcc.py
Last active October 19, 2019 15:50
不用開hichannel網頁也能聽中廣流行網
#!/usr/bin/env python
import time
import base64
import hashlib
import urllib
import urlparse
import urllib2
import subprocess
from collections import OrderedDict
@pa4373
pa4373 / ptt-crawler.js
Last active April 30, 2016 16:27
ptt-crawler
// npm i request cheerio json2csv
var fs = require('fs'),
request = require('request'),
cheerio = require('cheerio'),
json2csv = require('json2csv');
var HOST = 'https://www.ptt.cc';
var getMenu = function (url, callback, links) {
var links = links || []; // Set default value for links (initial call)
@pa4373
pa4373 / emacs.el
Created April 24, 2015 07:43
My emacs file, just getting started!
;; package.el setup and auto install on new machine
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(package-initialize)
(defvar local-packages '(auto-complete gotham-theme js2-mode markdown-mode pandoc-mode exec-path-from-shell projectile epc jedi))
(defun uninstalled-packages (packages)
(delq nil
@pa4373
pa4373 / controller.js
Last active August 29, 2015 14:10
Example angular.js coding style.
'use strict';
/**
* @ngdoc function
* @name ntuconnectAngularApp.controller:MeetupCtrl
* @description
* # MeetupCtrl
* Controller of the ntuconnectAngularApp
*/
angular.module('ntuconnectAngularApp')
@pa4373
pa4373 / groups.v
Created October 29, 2014 12:40
Some algebra proof about Group using Coq.
Section Group.
Variable G : Set.
Variable op : G -> G -> G.
Infix "o" := op (at level 35, right associativity).
Axiom assoc : forall a b c : G, a o (b o c) = (a o b) o c.
Variable e : G.
Axiom unit_l : forall a : G, e o a = a.
Axiom unit_r : forall a : G, a o e = a.
Axiom inv_l : forall a : G, exists b : G, b o a = e.
@pa4373
pa4373 / flip.py
Created August 20, 2014 11:54
Bit modification concept demonstration
'''
Usage:
$ python flip.py [SEED_NUMBER]
ex: python flip.py 3923
'''
import sys, random
message = [True, True, True, True, True, False, True, False]
carrier = [False, False, False, True, False, False, True, False, False, False, True, False, True, True, False]
#!/usr/bin/env python
import os, sys, struct
def parse_arg(argv):
if len(argv) != 2:
print 'require one argument.'
elif not 'Mach-O' in [i.rstrip() for i in os.popen('file %s' % argv[1])][0]:
print 'the argument must be Mach-O binary file.'
else:
return argv[1]
#!/usr/bin/env python
'''
This program simply flip cryptid to \x00, given offset.
WARNING: this will modify binary directly and without checking structure,
backup, and using with caution!
'''
import sys, os
def parse_arg(argv):
if len(argv) != 3:
@pa4373
pa4373 / gitbash_chifix.sh
Last active August 29, 2015 13:56
Fix chinese characters and input problem under Git Bash (MINGW32)
# Usage: $ curl -L [GIST_RAW_URL] | sh
echo "alias ls='/bin/ls --show-control-chars -F --color=tty'" >> /etc/profile
sed -i -e "s/PS1=\"\$PS1\"'\\\n'/#PS1=\"\$PS\"'\\\n'/g" /etc/profile
echo "set meta-flag on\nset input-meta on\nset output-meta on\nset convert-meta off" >> /etc/inputrc