Skip to content

Instantly share code, notes, and snippets.

View leoluyi's full-sized avatar
🎯
Focusing

Leo Lu leoluyi

🎯
Focusing
View GitHub Profile
@leoluyi
leoluyi / tmux-cheatsheet.markdown
Created June 23, 2016 13:55 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@leoluyi
leoluyi / tmux.md
Created July 9, 2016 02:56 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@leoluyi
leoluyi / Open iterm tab here
Created July 23, 2016 04:40 — forked from eric-hu/Open iterm tab here
Apple script to open an iterm2 tab from right-clicking on a file or folder in Finder. To use: (1) Open Automator (2) Create a new service (3) Change "Service receives selected" drop downs to "Files or folders" in "Finder" (4) Select "Run applescript" from the sidebar, then paste this script in and save
-- Adapted from these sources:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
-- https://gist.github.com/cowboy/905546
--
-- Modified to work with files as well, cd-ing to their container folder
on run {input, parameters}
tell application "Finder"
set my_file to first item of input
set filetype to (kind of (info for my_file))
-- Treats OS X applications as files. To treat them as folders, integrate this SO answer:
@leoluyi
leoluyi / Open_iTerm2.txt
Created July 28, 2016 13:45 — forked from suewonjp/Open_iTerm2.txt
[Mac OS X Tip] Open a new iTerm tab from the current folder in Finder
on run {input, parameters}
tell application "Finder"
set dir_path to quoted form of (POSIX path of (folder of the front window as alias))
end tell
CD_to(dir_path)
end run
on CD_to(theDir)
tell application "iTerm"
activate
@leoluyi
leoluyi / script-bash-redmine-backups
Created September 29, 2016 06:30 — forked from ronanguilloux/script-bash-redmine-backups
Backup script (daily & monthly) for Redmine (full instance + db sql snapshot)
#! /bin/bash
#
# backup_redmine.sh
# modified by [email protected]
# Inspiration: https://gist.github.com/gabrielkfr/6432185
#
# Distributed under terms of the MIT license.
# -- VARS
DAY=`date +"%Y%m%d"`
@leoluyi
leoluyi / Taiwan_geodetic_coor_conv.md
Created September 30, 2016 14:50 — forked from mutolisp/Taiwan_geodetic_coor_conv.md
台灣大地座標系統的轉換
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
2016-09-16 更新
最近內政部釋出 20 m DTM,志展(aka. Rex)收集了資料並做了許多處理應用(參見應用內政部20公尺網格數值地形模型資料),綬草北三也提到幾個參數轉換的更正,一併整理如下:

MillerLiu's comments:

「關於坐標轉換參數請務必更正, 引述參數文章關於轉換部分恰好是我多年前蒐集及撰寫的, OSG1是TWD67轉TWD97、OSG2則是Hu-Tzu-Shan轉TWD97、OSG3則是Bessel轉TWD97,
@leoluyi
leoluyi / server.R
Created October 13, 2016 02:25 — forked from withr/server.R
Encrypt password with md5 for Shiny-app.
library(shiny)
library(datasets)
Logged = FALSE;
PASSWORD <- data.frame(Brukernavn = "withr", Passord = "25d55ad283aa400af464c76d713c07ad")
# Define server logic required to summarize and view the selected dataset
shinyServer(function(input, output) {
source("www/Login.R", local = TRUE)
observe({
if (USER$Logged == TRUE) {
@leoluyi
leoluyi / index.js
Created November 10, 2016 11:52 — forked from edokeh/index.js
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@leoluyi
leoluyi / dbCreateTable.R
Last active February 14, 2017 08:05
DBI method for creating tables
# library(RSQLServer)
# library(RJDBC)
library(magrittr)
setGeneric("dbCreateTable", valueClass = "logical",
signature = c("conn", "name", "value"),
function(conn, name, value, ...) {
standardGeneric("dbCreateTable")
}
)
@leoluyi
leoluyi / tor.R
Created December 12, 2016 05:55 — forked from jeroen/tor.R
Using TOR in R
# Installing TOR on mac: brew install tor
# Run TOR on custom port: tor --SOCKSPort 9050
# Check the 'origin' field in the response to verify TOR is working.
library(httr)
GET("https://httpbin.org/get", use_proxy("socks5://localhost:9050"))
# Set proxy in curl
library(curl)
h <- new_handle(proxy = "socks5://localhost:9050")