Skip to content

Instantly share code, notes, and snippets.

View jonatw's full-sized avatar
🌴
On vacation

Jonathan Huang jonatw

🌴
On vacation
View GitHub Profile
@jonatw
jonatw / javascript_group_20120906
Created September 6, 2012 11:53
JavaScript Group / 20120906
表單驗證好書推薦
http://www.pcstore.com.tw/69book/M07276721.htm
form recovery (plugin , 小金人)
字數限制應該可以讓使用者輸入超過字數
提示的訊息 提示的全面性 提示的即時性 (最怕內容被拖拉填入) , autucomplete
http://registrano.com/events/jstw-20120906
######### I/O benchmark over network file system (RW random,1 thread) #########
root@debian:/mnt/www# sysbench --test=fileio --file-total-size=100M --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 1
Initializing random number generator from timer.
Extra file open flags: 0
@jonatw
jonatw / debian_lamp_build_guide
Created October 17, 2012 07:02
Debina LAMP with Cideigniter build guide
#!/bin/bash
#bash <(curl -fsSLk https://raw.github.com/gist/3904123)
#install packages
apt-get update
apt-get -y install apache2
apt-get -y install php5
apt-get -y install vim
apt-get -y install git-core
@jonatw
jonatw / .htaccess
Created October 17, 2012 07:24
jonathan_codeigniter_htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|robots\.txt|\.jpg|\.jpeg|\.png|\.doc|\.pdf|\.gif|\.bmp|\.ico|\.js|\.css)
RewriteRule ^(.*)$ index.php?/$1 [L]
@jonatw
jonatw / server.js
Last active December 10, 2015 17:28
nodejs practice #1 with native http object
// this practice is base on this documents http://nodejs.org/api/http.html#http_request_connection
var server,
ip = "192.168.1.12",
port = 1337,
http = require('http');
server = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
console.log("========== syslog ========== \n"+req.method+"\n"+req.url+"\n");
問題
ERROR 1129 (HY000): Host 'xx-xx-xx-xx-adsl-tpe.STATIC.so-net.net.tw' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'
解決方法
找一台可以還可以登入mysql server的機器 執行以下指令
mysqladmin -uroot -p -h{mysql server的位置} flush-hosts
@jonatw
jonatw / ssyn.c
Created January 22, 2013 07:52
someone hacked me :(
/*
Spoofed SYN by eKKiM
Educational purpose only please.
Compile with
gcc syn.c -pthread
*/
#include <stdio.h>
#include <stdlib.h>
#include <netinet/tcp.h>
#include <netinet/ip.h>
@jonatw
jonatw / install_compound.sh
Created April 24, 2013 07:01
install instruction for nodejs, compoundjs framework on debian/ubuntu linux
# install instruction for nodejs, compoundjs framework on debian/ubuntu linux
apt-get update
apt-get install curl vim git-core
curl https://raw.github.com/creationix/nvm/master/install.sh | sh
# append the following two lines into ~/.bashrc, e.g. /root/.bashrc
# [[ -s /root/.nvm/nvm.sh ]] && . /root/.nvm/nvm.sh # This loads NVM
# [[ -r $NVM_DIR/bash_completion ]] && . $NVM_DIR/bash_completion
# re-login console
@jonatw
jonatw / install_opencv_debian.sh
Last active September 1, 2016 04:58
install opencv on debian, tested on raspberry pi (debian wheezy)it takes "long time" for compiling opencv library. please be patient.Reference: http://opencv.willowgarage.com/wiki/InstallGuide_Linux
#install esseintal packages for opencv
apt-get -y install build-essential
apt-get -y install cmake
apt-get -y install pkg-config
apt-get -y install libgtk2.0-dev libgtk2.0
apt-get -y install zlib1g-dev
apt-get -y install libpng-dev
apt-get -y install libjpeg-dev
apt-get -y install libtiff-dev
apt-get -y install libjasper-dev
AWS_ACCESS_KEY_ID="YOURAWSACCESSKEYID"
AWS_SECRET_KEY="YOURAWSSECRETKEY"
EC2_REGION=$(wget -q -O - http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}')
EC2_INSTANCE_ID=$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-id)
EC2_CLOUDWATCH_NAMESPACE='WebService'
NGINX_CONNECTIONS=$(wget -q -O - http://127.0.0.1/nginx_status | grep 'connections' | awk '{print $3}')
/usr/bin/mon-put-data --region \"$EC2_REGION\" --metric-name HttpConnections --namespace \"$EC2_CLOUDWATCH_NAMESPACE\" --dimensions \"InstanceId=$EC2_INSTANCE_ID\" --value \"$NGINX_CONNECTIONS\" -I \"$AWS_ACCESS_KEY_ID\" -S \"$AWS_SECRET_KEY\"