Skip to content

Instantly share code, notes, and snippets.

View Leask's full-sized avatar
🏠
Working from home

Sixia "Leask" Huang Leask

🏠
Working from home
View GitHub Profile
@Leask
Leask / vpn.applescript
Last active December 20, 2015 00:19
Connect VPN via AppleScript
tell application "System Events"
tell current location of network preferences
set serviceVpn to service "NAME" -- name of the VPN service
if exists serviceVpn then connect serviceVpn
end tell
end tell
@Leask
Leask / md5.applescript
Last active December 20, 2015 01:28
Get md5 summary in AppleScript
set strA to "Leask Huang" -- PUT YOUR STRING HERE
do shell script "md5 -q -s '" & strA & "'"
@Leask
Leask / merge2ass.sh
Created July 21, 2013 16:30
script for merging two text-subtitles into an ass subtitle file
#!/bin/bash
# merge2ass.sh - script for merging two text-subtitles into an ass subtitle file
# version 0.9, 8-august-2007
# comments/criticism/praise to jose1711-gmail-com
# dependencies: mplayer (if your subtitle files need to be converted to srt), gnu utils
# thanks to:
# - d.watzke for comments
# - belisarivs for testing
@Leask
Leask / proxyswitch.sh
Created July 22, 2013 05:27
toggle your Mac's proxy status
#!/bin/sh
# Proxy Switch by LeaskH.com
if [ "`echo 'PUT YOUR PASSWORD HERE' | sudo -S networksetup -getsocksfirewallproxy Wi-Fi | grep '^Enabled'`" = 'Enabled: Yes' ]; then
sudo networksetup -setsocksfirewallproxystate Wi-Fi off
echo 'Turned off!'
else
sudo networksetup -setsocksfirewallproxystate Wi-Fi on
echo 'Turned on!'
fi
@Leask
Leask / crossdomain.xml
Created July 22, 2013 13:31
crossdomain.xml for Flash only
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*.com"/>
</cross-domain-policy>
@Leask
Leask / wx_sample.php
Created August 15, 2013 03:11
wechat php test by Tencent
<?php
/**
* wechat php test
*/
//define your token
define("TOKEN", "weixin");
$wechatObj = new wechatCallbackapiTest();
$wechatObj->valid();
@Leask
Leask / kext.sh
Created August 22, 2013 05:01
Replace /Applications/PCKeyboardHack.app/Contents/Library/scripts/kext.sh with this version. This cheat runs your PCKeyboardHack.app on OS X Mavericks.
#!/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin; export PATH
basedir="/Applications/PCKeyboardHack.app/Contents/Library"
kextfile=''
uname=`uname -r`
case "${uname%%.*}" in
11)
kextfile="$basedir/PCKeyboardHack.10.7.kext"
;;
@Leask
Leask / tcl-k40.txt
Created August 28, 2013 05:53
TCL K40 Hardware Configuration
Device Information Listing for Leask@TEST-16195D5B7C - 2007-5-13 13:29:48
Intel(R) 82801 PCI Bridge - 2448
Chip: Intel Corporation 82801BAM/CAM/DBM (ICH2-M/3-M/4-M) Hub
Interface to PCI Bridge
Detail
@Leask
Leask / rss-fetch-demo.aspx
Last active December 21, 2015 20:39
A RSS fetching demo in ASPX
<html>
<head>
<title>RSS 新闻采集程序 Demo</title>
</head>
<body>
<p>RSS 新闻采集程序 Demo</p>
<br>
<br>
<p>
<p>Demo A: 新华网国际新闻</p>
@Leask
Leask / paypal-dps.asp
Created August 28, 2013 06:33
A PayPal DPS example in ASP
<%@ Language=VBScript %>
<%
sXmlAction = sXmlAction & "<GenerateRequest>"
sXmlAction = sXmlAction & "<PxPayUserId>TestAccount</PxPayUserId>"
sXmlAction = sXmlAction & "<PxPayKey>ae4268ddc0bf1744d48f93f317bb5c23b444cbada22ecff3fae62d566e152595</PxPayKey>"
sXmlAction = sXmlAction & "<TxnType>Purchase</TxnType>"
sXmlAction = sXmlAction & "<CurrencyInput>NZD</CurrencyInput>"
sXmlAction = sXmlAction & "<AmountInput>2.03</AmountInput>"
sXmlAction = sXmlAction & "<MerchantReference>Test Transaction</MerchantReference>"