This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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'}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: hello | |
hello: hello.h | |
g++ -o hello hello.cpp | |
clean: | |
rm *.o hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On slave | |
adduser --system --group --home=/var/lib/jenkins --no-create-home --disabled-password --quiet --shell /bin/bash jenkins | |
install -d -o jenkins -g jenkins /var/lib/jenkins | |
install -d -m 700 -o jenkins -g jenkins /var/lib/jenkins/.ssh | |
apt-get install -y openjdk-7-jre-headless git-core nfs-common | |
cat > /etc/cron.hourly/ntpdate <<EOF | |
#!/bin/bash | |
ntpdate 172.16.11.254 | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
OlderNewer