Skip to content

Instantly share code, notes, and snippets.

View aaronchiang's full-sized avatar

Aaron Chiang aaronchiang

View GitHub Profile
var express = require('express')
, http = require('http')
, connect = require('connect')
, io = require('socket.io');
var app = express();
/* NOTE: We'll need to refer to the sessionStore container later. To
* accomplish this, we'll create our own and pass it to Express
* rather than letting it create its own. */
var sessionStore = new connect.session.MemoryStore();
//express3.0
var express = require('express');
var app = express();
app.set('port', 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.methodOverride());
//session & cookie
@aaronchiang
aaronchiang / 0_reuse_code.js
Created April 21, 2014 05:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
SERVER="dc1.us.yourcompany.com"
DN="CN=aUserLogin,OU=SomeOrgUnit,OU=AnotherOrgUnit,DC=dc1,DC=us,DC=yourcompany,DC=com"
PASSWORD="aUserLoginsPassword"
OU="ou=AnotherOrgUnit,dc=us,dc=yourcompany,dc=com"
ldapsearch -h "$SERVER" -p 389 \
-x -D "$DN" -w "$PASSWORD" \
-t -s sub -b "$OU" "(&(objectClass=user)(sAMAccountName=anotherUserLogin))" "thumbnailPhoto"
<?php
/**
* LDAP PHP Change Password Webpage
* @author: Matt Rude <http://mattrude.com>
* @website: http://technology.mattrude.com/2010/11/ldap-php-change-password-webpage/
*
*
* GNU GENERAL PUBLIC LICENSE
* Version 2, June 1991
@aaronchiang
aaronchiang / init.lua
Created October 5, 2016 01:16 — forked from lucifr/init.lua
My Hammerspoon config file
-- -------------------------------
-- Watcher for changes of init.lua
-- -------------------------------
function reloadConfig(files)
doReload = false
for _,file in pairs(files) do
if file:sub(-4) == ".lua" then
doReload = true
end
end
@aaronchiang
aaronchiang / gist:a8f5e1d56e0164c3ce9c46c63c084715
Created February 14, 2017 03:31 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@aaronchiang
aaronchiang / merge-pdf-ghostscript.md
Created May 12, 2017 02:45 — forked from brenopolanski/merge-pdf-ghostscript.md
Merge multiple PDFs using Ghostscript

A simple Ghostscript command to merge two PDFs in a single file is shown below:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combine.pdf -dBATCH 1.pdf 2.pdf

Install Ghostscript:

Type the command sudo apt-get install ghostscript to download and install the ghostscript package and all of the packages it depends on.

public static class LINQPadExtensions
{
private static readonly Dictionary<Type, string> TypeAliases = new Dictionary<Type, string> {
{ typeof(int), "int" },
{ typeof(short), "short" },
{ typeof(byte), "byte" },
{ typeof(byte[]), "byte[]" },
{ typeof(long), "long" },
{ typeof(double), "double" },
{ typeof(decimal), "decimal" },
@aaronchiang
aaronchiang / Angular 5 開發環境說明.md
Created November 10, 2017 00:51 — forked from doggy8088/Angular 18 Dev Setup.md
Angular 5 開發環境說明

Angular 5 開發環境說明

為了能讓大家能夠順利的建立起 Angular 5 開發環境,以下是需要安裝的相關軟體與安裝步驟與說明。

[ 作業系統 ]

  • Windows 7 以上版本 (更新到最新 Service Pack 版本)
  • Mac OS X 10.6 以上版本

[ 套件管理器 ( Mac OS X Only ) ]