Skip to content

Instantly share code, notes, and snippets.

View wastemobile's full-sized avatar

wastemobile wastemobile

View GitHub Profile
@wastemobile
wastemobile / prototype.md
Created June 12, 2019 15:09
Hugo prototype with Pipes #hugo
@wastemobile
wastemobile / dailyupdate
Last active February 12, 2019 01:39
Daily Update Script for Mac
#!/bin/bash
echo "Update Homebrew"
echo "brew update && brew upgrade --all"
brew update && brew upgrade
echo "brew cleanup"
brew cleanup -s
echo "Update NPM global"
@wastemobile
wastemobile / nginx_with_ssl.md
Last active May 13, 2018 20:01
Nginx + Let's Encrypt
@wastemobile
wastemobile / helloHtml.js
Last active April 29, 2017 01:52
一個檔案理解 Node for Web
var http = require('http'),
fs = require('fs');
function serveStaticFile(res, path, contentType, responseCode) {
if(!responseCode) responseCode = 200;
fs.readFile(__dirname + path, function(err, data){
if(err) {
res.writeHead(500, {'Content-Type': 'text/plain'});
res.end('500 - Internal Error');
} else {
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
function git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
echo "("${ref#refs/heads/}") ";
}
function git_since_last_commit {

Vagrant 可以配置本地開發環境(虛擬機),同時管理遠端主機(Digital Ocean),在一個專案目錄下、只用一個 Vagrantfile。

首先安裝外掛:

vagrant plugin install vagrant-digitalocean

#!/bin/bash
# install xcode command tool
xcode-select --install
# check
xcode-select -p
# install brew
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
#!/bin/bash
echo -e "\n移除不需要的預設套件"
meteor remove autopublish insecure
echo -e "\n安裝基礎會員帳戶套件"
meteor add accounts-password alanning:roles
echo -e "\n安裝 Flow 路由套件"
meteor add kadira:flow-router kadira:blaze-layout
@wastemobile
wastemobile / Pi2_OS.md
Last active August 29, 2015 14:25
Raspberry Pi 2

官方調教的是 Raspbian,Debian 的分支,目前代號Wheezy,也就是 Debian 7。

可手動升級到 Debian 8 Jessie。

首先將官方映像燒到 SD 卡,Mac 上推薦使用 ApplePi-Baker 程式。

在最簡模式,插入 Raspbian SD 卡、接上實體網路線、接上 USB 電源,系統會自動從區網 DHCP 取得網路 ip,從遠端 Mac 上以終端機 ssh 登入,執行 ssh pi@192.168.x.x 預設密碼是 raspberry。

登入後先執行 sudo raspi-config,使用文字選取介面完成幾項初始工作:

#!/bin/bash
set -o errexit
# IP or URL of the server you want to deploy to
APP_HOST=example.com
# Uncomment this if your host is an EC2 instance
# EC2_PEM_FILE=path/to/your/file.pem
# You usually don't need to change anything below this line