Skip to content

Instantly share code, notes, and snippets.

@pastleo
pastleo / gen-ssh-key.md
Last active August 29, 2015 14:08
How to generate ssh-key pair in unix

Imgur

@pastleo
pastleo / Preference.sublime-settings
Created October 23, 2014 13:21
My Sublime Text 3 Preference
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"color_scheme": "Packages/User/PastLeoFaviColor.tmTheme",
"default_encoding": "UTF-8",
"detect_indentation": true,
"draw_minimap_border": true,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
@pastleo
pastleo / PastLeoFaviColor.tmTheme
Created October 23, 2014 13:35
My Sublime Text 3 Theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
======================================================================
PastLeoFaviColor
======================================================================
A Sublime Text 2 / Textmate theme.
Modified from FreshCut by PastLeo on 2014/4/29.
======================================================================
-->
@pastleo
pastleo / SSH_tunneling.md
Created November 5, 2014 06:55
Unix SSH and tunneling 教學

SSH and tunneling

  • Normal ssh connection:

    ssh <user>@<hostname_or_ip>
    
  • ssh tunnel

@pastleo
pastleo / GithubEduSSL_nginx.md
Last active August 29, 2015 14:15
Github edu SSL solution with Nginx

Github edu SSL with Nginx

這篇文章寫到最後才發現 Cloudflare 自己就已經提供免費的 SSL 可以使用,如果你已經有在用 (真的蠻好用的,重點是永久免費),所以可以先直接往下滑找到 設定 Cloudflare 的 SSL 模式 區塊看看

之前有用過 StarSSL 來作為 SSL for https 的 CA,原因當然是因為不用錢 (好像是永久免費,每年 renew 一次即可),但是使用後發現他的免費憑證 (Class 1) 在手機上還是會顯示出無法驗證憑證的訊息,所以就放棄使用 https 了

之前 Github 推出 Student Developer Pack 提供給窮學生們免費使用各種付費服務,其中有 VPS by Digital Ocean, Domain name by namecheap and SSL by namecheap,最近正好想到 中興大學學生會 ILT 會員系統 理論上必須要架設在 https 環境下使用,今天就是要來使用 PositiveSSL by namecheap 把原本沒有 SSL 的 ILT 系統加上 SSL 使之更安全

這個簡單的教學只是把我申請、設定的過程記錄下來而已,在開始前已經

@pastleo
pastleo / Hackpad_code.md
Last active August 29, 2015 14:18
How to create code with syntax hightlight

How to create code with syntax hightlight

@pastleo
pastleo / PythonHW1_s101056017.py
Created May 19, 2015 12:14
PythonHW1_s101056017 ID generator
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Tkinter import *
import random
Proj_name = "PythonHW1_s101056017 ID generator"
random.seed()
root = Tk(Proj_name)
@pastleo
pastleo / installation.sh
Created October 4, 2015 20:35
My OSX Environment Setup Scripts
# get brew, more info here: http://brew.sh
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# get packages
brew install \
android-sdk autoconf automake bash boost brew-cask cloog cloog018 composer cowsay docker docker-machine emacs faac fig findbugs fish freetype gcc gcc49 gdbm gettext git git-lfs glew glfw3 gmp gmp4 go gradle highlight htop-osx icu4c isl isl011 jpeg lame libav libevent libgpg-error libksba libmpc libmpc08 libpng libtool libyaml lua mpfr mpfr2 node nvm openssl p7zip pgcli php56 pkg-config postgresql python python3 readline reattach-to-user-namespace ruby sdl2 sl source-highlight sqlite thefuck tmux tree unixodbc unrar vim vsftpd wget x264 xvid xz zlib
http://caskroom.io
brew install caskroom/cask/brew-cask
@pastleo
pastleo / .minttyrc
Created December 28, 2015 07:06
mintty settings
BoldAsFont=yes
Transparency=low
Term=xterm-256color
CursorType=block
Locale=C
Charset=UTF-8
BellFlash=yes
BellTaskbar=no
OpaqueWhenFocused=yes
Font=Consolas
@pastleo
pastleo / chrome bookmark to import jQuery
Last active January 2, 2016 07:59
Somehow just need jQuery to do something (dirty)...
javascript: var jQueryScriptSourceURL='//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js'; var jQueryScript=document.createElement('script'); jQueryScript.setAttribute('src',jQueryScriptSourceURL); if(document.getElementsByTagName('head').item(0)==null) document.getElementsByTagName('html').item(0).appendChild(document.createElement('head')); jQueryScript=document.getElementsByTagName('head').item(0).appendChild(jQueryScript); varjQueryScriptLoadCompleted=function(){}; jQueryScript.onload=function(jQueryScriptLoadEvent){ try{ console.log('Self test ...$("head").html()=\n'+$("head").html()); console.log("jQueryScript loaded!"); jQueryScriptLoadCompleted(); }catch(exception){ console.log('Fatal Error:'+exception.message); if(!jQueryScriptLoadEvent.returnValue) console.log('Loading jQueryScript was failed!'); } }; jQueryScriptLoadCompleted=function(){ console.log("要執行的JS和jQuery請定義在jQueryScriptLoadCompleted裡\n同時也請注意在網址上加入要執行的JS是不能加註解的\nLet's party!!!"); };