Skip to content

Instantly share code, notes, and snippets.

View dm4's full-sized avatar
4️⃣

dm4 dm4

4️⃣
View GitHub Profile
# Usage: pr (pull request current branch into develop)
# Usage 2: pr stable (pull request current branch into stable)
function pr() {
base=$1;
if [ "$1" == "" ]; then
base="develop"
fi
hub pull-request -b team:"$base" -h team:`git rev-parse --abbrev-ref HEAD`;
}
@dm4
dm4 / Macros.h
Created February 26, 2013 09:01 — forked from numo16/Macros.h
#define ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])
#define UserDefaults [NSUserDefaults standardUserDefaults]
#define NotificationCenter [NSNotificationCenter defaultCenter]
#define SharedApplication [UIApplication sharedApplication]
#define Bundle [NSBundle mainBundle]
#define MainScreen [UIScreen mainScreen]
#define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES
#define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO
#define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x
#define NavBar self.navigationController.navigationBar
invoke-virtual v0, v1, v5, Landroid/content/Intent;->putExtra(Ljava/lang/String; Ljava/lang/String;)Landroid/content/Intent;
v0
invoke-virtual v0, v1, v2, Landroid/content/Intent;->putExtra(Ljava/lang/String; Landroid/os/Parcelable;)Landroid/content/Intent;
v0
invoke-virtual v0, v1, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;
v0
invoke-direct v0, v1, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
v0
new-instance v0, Landroid/content/Intent;
v1
invoke-virtual v0, v1, v2, Landroid/content/Intent;->putExtra(Ljava/lang/String; Ljava/lang/String;)Landroid/content/Intent;
v0
invoke-virtual v0, v1, v2, Landroid/content/Intent;->putExtra(Ljava/lang/String; Landroid/os/Parcelable;)Landroid/content/Intent;
v0
invoke-virtual v0, v1, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;
v0
invoke-direct v0, v1, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
v0
new-instance v0, Landroid/content/Intent;
v1
#include <stdio.h>
#include <deque>
#include <map>
#define MAX_CHILD_NUM 10
using namespace std;
typedef struct _obj {
struct _obj *child[MAX_CHILD_NUM];
@dm4
dm4 / submit.sh
Created December 12, 2012 19:15
submit to ml12fall final from remote host
id="your id here"
pw="your password here"
filename="$1"
algo_name="$2"
curl -s -c cookie -d "team_name=${id}&passwd=${pw}&submit=submit" 'http://main.learner.csie.ntu.edu.tw/php/ml12fall/login.php' > /dev/null
curl -s -o output.html -b cookie -F "userfile=@${filename};type=text/plain" -F "algouse=${algo_name}" 'http://main.learner.csie.ntu.edu.tw/php/ml12fall/cal.php'
sed -nE 's/.*(AUC \(first-half\): [0-9\.]+).*/\1/p' output.html
@dm4
dm4 / gist:4070732
Created November 14, 2012 06:56
to henry3716
for i in `seq 102 104`
do
join sum.list $i.list | awk '{print $6=(0.65*($4-$2)^2+($5-$3)^2)^(0.5)}' > $i.out
done
cat *.out > all.out
@dm4
dm4 / web5.pl
Created July 26, 2012 06:44
HITCON 2012 Wargame Web 5
#!/usr/bin/perl -w
use 5.010;
use LWP;
use URI::Escape;
use strict;
my $str = 'abcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*()_+`-=[]\\{}|;\':",./<>? ';
my @chars = map { uri_escape($_) } split //, $str;
my @stack;
@dm4
dm4 / 下推.vb
Created May 7, 2012 05:05
國二寫的人生第一隻程式
VERSION 5.00
Begin VB.Form Form1
Caption = "上推"
ClientHeight = 5415
ClientLeft = 60
ClientTop = 345
ClientWidth = 6930
LinkTopic = "Form1"
ScaleHeight = 5415
ScaleWidth = 6930
@dm4
dm4 / Makefile
Created March 7, 2012 11:47
DSA Homework #1
main: poly.cpp main.cpp poly.h
g++ dm4.cpp main.cpp -o poly
run:
./poly < input