Skip to content

Instantly share code, notes, and snippets.

View dm4's full-sized avatar
4️⃣

dm4 dm4

4️⃣
View GitHub Profile
@dm4
dm4 / trace.pl
Created February 20, 2011 12:40
Trace directory using perl
&trace('.');
sub trace {
my $dir = shift;
for (<$dir/*>) {
&trace($_) if -d $dir;
}
print $dir."\n";
}
@dm4
dm4 / git_tips.md
Created April 30, 2011 08:08 — forked from fguillen/git_tips.md
Git Tips

(Several of these git examples have been extracted from the book 'Pragmatic guide to GIT' of Travis Swicegood )

Git tips

Global git user

git config --global user.name "Fernando Guillen"
git config --global user.email "fguillen.mail+spam@gmail.com"

Repository git user

cd /develop/myrepo

@dm4
dm4 / highway.cc
Created June 19, 2011 13:43
ACP Homework
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#define MAXSITE 410
using namespace std;
@dm4
dm4 / 自動填教學意見調查
Created December 5, 2011 17:06 — forked from jimmyken793/自動填教學意見調查
自動填教學意見調查
把以下的東西存成bookmark 然後在填答表格那頁點下去 然後Magic!!
javascript:y=document.forms['frm1'].elements;for(var j=1;j<=28;j++){a=y['ans'+j];if(a){var c=a.length;if(c==undefined){a.checked=(a.value=='3')}for(var i=0;i<c;i++){a[i].checked=false;if(a[i].value=='3'){a[i].checked=true}}}}
@dm4
dm4 / hw2.sh
Created December 11, 2011 07:38
trace.sh
#!/bin/bash
[ -z "$1" ] && echo '請輸入目錄' && exit
[ ! -d "$1" ] && echo '請輸入目錄' && exit
trace() {
if [ -d "$1" ]; then
for file in "$1/"*.txt
do
echo "$file"
@dm4
dm4 / gist:1616584
Created January 15, 2012 17:55
find pair
hput () {
eval hash"$1"='$2'
}
hget () {
eval echo '${hash'"$1"'#hash}'
}
for tmp in "$@"
do
if [ "`hget $tmp`" != "" ]
then
@dm4
dm4 / gist:1619367
Created January 16, 2012 06:20
find pair
hput () {
eval hash"${1//[.-]/a}"='$2'
}
hget () {
eval echo '${hash'"${1//[.-]/a}"'#hash}'
}
for tmp in "$@"
do
tmp=`echo $tmp | cut -c 5-`
tmp=`echo $tmp | cut -d_ -f1`
@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
@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 / 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;