Skip to content

Instantly share code, notes, and snippets.

Jethro Yu jcppkkk

  • Taipei
View GitHub Profile
@jcppkkk
jcppkkk / gist:6522576
Created Sep 11, 2013
Load Cookie Monster and Highlighter
View gist:6522576
javascript: (function () {
function loadScript(b, c) {
var a = document.createElement("script");
a.type = "text/javascript";
if (a.readyState) {
a.onreadystatechange = function () {
if (a.readyState == "loaded" || a.readyState == "complete")
{a.onreadystatechange = null; c() } }
} else {a.onload = function () {c() } } a.src = b;
document.getElementsByTagName("head")[0].appendChild(a)
@jcppkkk
jcppkkk / gist:6409139
Last active Dec 22, 2015
Cookie clicker assistant (Bookmarklet) store the code as a bookmark, then click it when you are in Cookie clicker.
View gist:6409139
javascript: (function () {
function loadScript(b, c) {
var a = document.createElement("script");
a.type = "text/javascript";
if (a.readyState) {
a.onreadystatechange = function () {
if (a.readyState == "loaded" || a.readyState == "complete")
{a.onreadystatechange = null; c() } }
} else {a.onload = function () {c() } } a.src = b;
document.getElementsByTagName("head")[0].appendChild(a)
View gist:6391457
Sub SendMessage()
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
@jcppkkk
jcppkkk / install.sh
Created Nov 29, 2012 — forked from alvin2ye/install.sh
Automaticlly install pptpd on Ubuntu 12.04
View install.sh
# Authors: Alvin Ye
# Run by: curl -sL https://gist.github.com/1471830.txt | sudo bash
sudo apt-get install pptpd
sed -i 's/^logwtmp/#logwtmp/g' /etc/pptpd.conf
sed -i 's/^net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g' /etc/sysctl.conf
sysctl -p
echo "localip 192.168.240.1" >> /etc/pptpd.conf
@jcppkkk
jcppkkk / gist:4149704
Created Nov 26, 2012
Boyer-Moore algorithm
View gist:4149704
#define MAX(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; })
#include <stdio.h>
#include <string.h>
#define XSIZE 20
#define ASIZE 256
@jcppkkk
jcppkkk / gist:3909904
Created Oct 18, 2012
rdiff-backup statistics
View gist:3909904
root@bbs[ /home/BBSBACKUP ] > rdiff-backup --calculate-average rdiff-backup-data /session_statistics.2012-*
--------------[ Average of 5 stat files ]--------------
ElapsedTime 686.29 (11 minutes 26.29 seconds)
SourceFiles 470907.8
SourceFileSize 3107723617.8 (2.89 GB)
MirrorFiles 448015.6
MirrorFileSize 2984598578.2 (2.78 GB)
NewFiles 23082.8
NewFileSize 125044623.6 (119 MB)
DeletedFiles 190.6
@jcppkkk
jcppkkk / gist:3293436
Created Aug 8, 2012
Get topTask and it's PID
View gist:3293436
static final String TAG = "XXX_TAG"
am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
RunningTaskInfo topTask = am.getRunningTasks(1).get(0);
String pkg = topTask.baseActivity.getPackageName();
int pid = findForgroundPID(pkg);
private int findForgroundPID(String topPackage) {
int pid = -1;
List<RunningAppProcessInfo> procList = am.getRunningAppProcesses();
for (RunningAppProcessInfo proc : procList) {
@jcppkkk
jcppkkk / Makefile
Created Jun 5, 2012 — forked from shafreeck/Makefile
Makefile example
View Makefile
all: hello
hello: hello.h
g++ -o hello hello.cpp
clean:
rm *.o hello
@jcppkkk
jcppkkk / gist:2762736
Created May 21, 2012
[python] Basics
View gist:2762736
## Dict Database for col_fam.batch_insert()
a={}
for r in range(3):
row_key='raw{}'.format(r)
a[row_key]={}
for i in range (5):
a[row_key]['name{}'.format(i)]='val{}'.format(i)
print a
##{'raw2': {'name4': 'val4', 'name2': 'val2', 'name3': 'val3', 'name0': 'val0', 'name1': 'val1'},
View gist:2204861
#!/bin/bash
# bgxupdate - update active processes in a group.
# Works by transferring each process to new group
# if it is still active.
# in: bgxgrp - current group of processes.
# out: bgxgrp - new group of processes.
# out: bgxcount - number of processes in new group.
bgxupdate() {
You can’t perform that action at this time.