Skip to content

Instantly share code, notes, and snippets.

View beeant's full-sized avatar
🎯
Focusing

₿ryant Teja beeant

🎯
Focusing
View GitHub Profile
/* node getImages.js http://www.yahoo.co.jp */
var htmlparser = require('htmlparser');
var sys = require('sys');
var http = require('http');
var fs = require('fs');
var url = require('url');
var path = require('path');
if(process.argv.length !== 3){
/*
use dot separated string as nested object path
and parse it to get the value
*/
// sample nested object:
var messages =
errors: {
username: {
validation: 'Username is invalid'
}
@beeant
beeant / cache locals
Created October 21, 2013 07:03
locals lazy loading
// always defined locals
res.locals.user = req.user;
// cached locals
if (req.xhr) { return next(); }
console.log(req.url);
/* ************ *
* Non XHR only
* ************ */
@beeant
beeant / gist:7131396
Last active December 26, 2015 09:39
re-map mouse to touch event and vice versa
(function () {
var MOVE_THRESHOLD = 20;
// 'tap'イベントをjQueryに登録
$.event.special.tap = {
setup: function() {
var self = $(this);
self.on('touchstart', function(e) {
var moved = false,
origTarget = e.target,
origEvent = e.originalEvent,
@beeant
beeant / gist:7199853
Created October 28, 2013 16:16
grepall
alias grepall='find . | xargs grep -s -n --color -E'
sudo port install php55 +fastcgi fcgi apache-ant php55-cgi php55-mbstring php55-curl php55-mcrypt php55-imagick php55-xdebug php55-iconv php55-mongo php55-oauth php55-openssl php55-esmtp php55-pop3 php55-tidy php55-uploadprogress php55-pcntl php55-sockets php55-soap php55-ssh2 php55-big_int php55-gd php55-svm php55-html_parse php55-http php55-mysql php55-pdflib php55-pear php55-peb php55-posix php55-pspell php55-rar php55-redis php55-snmp php55-stomp php55-svn php55-wddx php55-xmlrpc php55-yaml php55-zip php55-dbase php55-excel php55-gdchart php55-imap php55-xsl php55-redis
sudo port install postgresql92 postgresql92-server postgresql92-doc postgresql_autodoc php55-postgresql phppgadmin postgresql-jdbc mysql5-server phpmyadmin maven3 maven-ant-tasks
sudo port install nginx +flv +geoip +gzip_static +mail +mp4 +ssl +status +substitution +upload +upload_progress +xslt +zip
You may need to update your php.ini for any changes that have been made in this version of php55. Compare /opt/local/etc/php55/php.ini wit
@beeant
beeant / package.json
Created April 27, 2014 03:53
JCJP package.json gist
{
"keywords": [],
"devDependencies": {
"async": "^0.7.0",
"body-parser": "^1.0.2",
"canvas": "~1.1.3",
"cheerio": "^0.12.4",
"colors": "~0.6.2",
"compression": "^1.0.1",
"connect-flash": "^0.1.1",
/*var cluster = require('cluster');
var cpuCount = require('os').cpus().length;
if (cluster.isMaster) {
for (var i = 0; i < cpuCount; i += 1) {
cluster.fork();
}
} else {*/
var express = require('express'),
http = require('http'),
@beeant
beeant / block.sh
Last active August 29, 2015 14:15 — forked from jtadeulopes/block.sh
# sudo sh block.sh
-I INPUT 1 -p tcp --dport 80 -m string --string "ads.yahoo.com" --algo kmp -j DROP
-I INPUT 1 -p tcp --dport 80 -m string --string "ads.fcmrktplace.com" --algo kmp -j DROP
-I INPUT 1 -p tcp --dport 80 -m string --string "ads.creafi-online-media.com" --algo kmp -j DROP
-I INPUT 1 -p tcp --dport 80 -m string --string "ib.reachjunction.com" --algo kmp -j DROP
-I INPUT 1 -p tcp --dport 80 -m string --string "www.indeed.com" --algo kmp -j DROP
-I INPUT 1 -p tcp --dport 80 -m string --string "ib.adnxs.com" --algo kmp -j DROP
-I INPUT 1 -p tcp --dport 80 -m string --string "ad.tagjunction.com" --algo kmp -j DROP
-I INPUT 1 -p tcp --dport 80 -m string --string "ad.globe7.com" --algo kmp -j DROP
-I INPUT 1 -p tcp --dport 80 -m string --string "ads.clicksor.com" --algo kmp -j DROP
@beeant
beeant / webdriver.sh
Created August 5, 2015 10:53
webdriver startup script
### BEGIN INIT INFO
# Provides: transparentproxy
# Required-Start: $local_fs $syslog $remote_fs dbus
# Required-Stop: $local_fs $syslog $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start transparentproxy
### END INIT INFO
#
# /etc/rc.d/init.d/webdriver