Skip to content

Instantly share code, notes, and snippets.

@IskenHuang
IskenHuang / things-to-fantastical.applescript
Created August 12, 2017 15:08
Things3 complete todos create calendar event to fantastical.
(*
## Goal
This script is make new calendar event to fantastical2 from things3 complete todos in 'Logbook' on specified date.
## How to use:
* Default is today
* `$ osascript things-to-fantastical.applescript`
* The specified date
* `$ osascript things-to-fantastical.applescript 2017/08/12`
*)
@IskenHuang
IskenHuang / Things to CSV.scpt
Created July 30, 2017 09:24 — forked from leonroy/Things to CSV.scpt
Convert Things database to CSV. This script produces two CSVs on the user's Desktop. One for todos and the other for projects. It requires that Things.app is installed.
---------
-- Convert Things (from Cultured Code) database to CSV
-- https://culturedcode.com/things/
--
-- Version 1.0
--
-- This script produces two CSVs on the user's Desktop. One for todos and the other for projects.
-- It requires that Things.app is installed.
--
-- Things todos and projects can be tied either using the project name in the todos CSV or better
@IskenHuang
IskenHuang / fps.js
Last active July 24, 2017 02:22
Performance monitor in javascript
var __LAST_CALLED_TIME__ = 0;
function requestAnimFrame() {
if(!__LAST_CALLED_TIME__) {
__LAST_CALLED_TIME__ = Date.now()
return 0
}
var delta = (Date.now() - __LAST_CALLED_TIME__)/1000
__LAST_CALLED_TIME__ = Date.now()
console.log('fps = ', 1/delta)
@IskenHuang
IskenHuang / scan.sh
Last active November 29, 2017 02:34
Scan url response have keywords
#!/bin/bash
# fetch the page and using regex to catch keywords. When catch the keywords will save to result.txt
array=(
"https://www.tmall.com"
)
index=1
echo "Scan start"
for i in "${array[@]}"
do
(*
Export Evernote notes to Apple Notes
Copyright (C) 2015 Lawrence A. Salibra, III
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@IskenHuang
IskenHuang / proxy.py
Created January 14, 2016 10:06
mitmproxy scripts
#!/usr/bin/env python
# https://docs.mitmproxy.org/en/stable/scripting/inlinescripts.html#inline-scripts
def response(context, flow):
if 'www.taobao.com' in flow.request.host:
flow.request.host = 'www.tmall.com'
def request(context, flow):
if 'www.taobao.com' in flow.request.host:
flow.request.host = 'www.tmall.com'
@IskenHuang
IskenHuang / git-author-rewrite-cli.sh
Last active September 28, 2019 10:03
Change your git commit name. Filter your commit by email to change commit name and email
#!/bin/sh
git filter-branch -f --env-filter '
OLD_EMAIL="$2"
CORRECT_NAME="$3"
CORRECT_EMAIL="$4"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
#!/bin/sh
#
# Amazon EC2 user-data file for automatic configuration of IPsec/L2TP VPN
# on a Ubuntu server instance. Tested with 14.04 (Trusty) AND 12.04 (Precise).
# With minor modifications, this script *can also be used* on dedicated servers
# or any KVM- or XEN-based Virtual Private Server (VPS) from other providers.
#
# DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! THIS IS MEANT TO BE RUN WHEN
# YOUR AMAZON EC2 INSTANCE STARTS!
#

OpenVPN on Ubuntu 12.10 at DigitalOcean

Install OpenVPN

sudo apt-get install openvpn

Generate Server Certificates

sudo cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0 /etc/openvpn/easy-rsa2

cd /etc/openvpn/easy-rsa2

OpenVPN on Ubuntu 12.10 at DigitalOcean

Install OpenVPN

sudo apt-get install openvpn

Generate Server Certificates

sudo cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0 /etc/openvpn/easy-rsa2

cd /etc/openvpn/easy-rsa2