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
class XMPPHandler(xmpp_handlers.CommandHandler): | |
def text_message(self, message): | |
idx = message.sender.index('/') | |
user = message.sender[0:idx] | |
logging.debug(user) |
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
import urllib | |
import json | |
from google.appengine.api import mail | |
from google.appengine.ext import webapp, db | |
from google.appengine.ext.webapp import util | |
from google.appengine.ext.webapp.util import run_wsgi_app | |
class Feedback(db.Model): | |
user = db.StringProperty() |
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
function showPic(){ | |
$("#studentImage").hide().html(getPic()).fadeIn(2000); | |
$("#studentId").val(""); | |
$("#fullname").val(""); | |
} | |
function getPic(){ | |
var idval = $("#studentId").val(); | |
var nameval = $("#fullname").val(); | |
url = '<img src="Directory of the schools site that pictures resides at' + idval + '-' + nameval + '.jpg" onerror="notFound()"/>'; |
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
<html> | |
<head> | |
<link type="text/css" href="style.css" rel="stylesheet" /> | |
<script src="jquery.js"></script> | |
<script src="getpic.js"></script> | |
</head> | |
<body> | |
<div id="header"> | |
<a href="http://myrp.sg/sass-student/" target="_blank">Login here</a> | |
before using this extension |
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
site = SitesApp.getSite("myrp.edu.sg", "sitesdemo"); // domain and site's name (url) | |
list = site.getListPages(); //get all ListPages and store inside an array | |
function updateList(){ | |
var sheet = SpreadsheetApp.getActiveSheet(); //get the Spreadsheet that the script is executed from | |
var startRow = 2; | |
var numRows = sheet.getLastRow()-1; //get number of rows to fetch data | |
var dataRange = sheet.getRange(startRow,1,numRows,3); //range based on A1 notation | |
var data = dataRange.getValues(); | |
var columns = ["Name","Email"]; //column names in the ListPage |
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
register_growl() | |
growlnote("Copying process", "bootpd.plist copied") | |
do shell script "sudo cp /tmp/bootpd.plist /etc" password "yourpassword" with administrator privileges | |
tell application "System Preferences" to set current pane to pane "com.apple.preferences.sharing" | |
tell application "System Events" to tell process "System Preferences" | |
click checkbox 1 of row 11 of table 1 of scroll area 1 of group 1 of window "Sharing" | |
delay 1 | |
if (exists sheet 1 of window "Sharing") then | |
click button "Start" of sheet 1 of window "Sharing" | |
end if |
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
<?php | |
/* Author: Ngo Minh Nam */ | |
$dirs = array_filter(glob(dirname(__FILE__)."/*"), 'is_dir'); | |
print_r($dirs); | |
foreach($dirs as $dir){ | |
chdir($dir); | |
$output = shell_exec('git pull'); | |
echo $output; | |
} |
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
<?php | |
// Author: Ngo Minh Nam | |
$dir = "/path/to/your/repo/"; | |
$output = array(); | |
chdir($dir); | |
exec("git log",$output); | |
$history = array(); | |
foreach($output as $line){ | |
if(strpos($line, 'commit')===0){ |
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
function gsup(){ | |
gsutil cp "$@" gs://geeknam.info | |
} | |
function gsdown(){ | |
gsutil cp gs://geeknam.info/"$@" ~/Desktop | |
} |
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
hardstatus alwayslastline | |
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]' | |
screen -t screen1 0 | |
screen -t screen2 1 | |
screen -t screen3 3 |
OlderNewer