Skip to content

Instantly share code, notes, and snippets.

View aaronchiang's full-sized avatar

Aaron Chiang aaronchiang

View GitHub Profile
@aaronchiang
aaronchiang / .gitconfig
Created December 27, 2017 06:24 — forked from danny0838/.gitconfig
實用的 Git 配置值
[core]
quotepath = false # 中文檔名如實顯示而不轉碼
autocrlf = false # commit 及 checkout 時不根據作業系統轉換檔案的換行字元 (避免不小心改動原 repo 的換行字元)
safecrlf = false # 檢查文字類檔案是否混合了 CRLF 及 LF 換行字元 (搭配 autocrlf,這裡一起關閉)
ignorecase = false # 檔名大小寫不同時視為相異 (更動大小寫才能 commit)
whitespace = cr-at-eol # diff 時行尾 CRLF 不顯示 ^M
fileMode = false # 忽略檔案的 x 屬性 (for Windows)
symlinks = false # 忽略符號連結 (for Windows)
editor = /usr/bin/vim # 預設的文字編輯器 (for Linux)
[alias]
@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 ) ]

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 / 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.

@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 / 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
<?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
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"
@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
//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