Skip to content

Instantly share code, notes, and snippets.

View pwlin's full-sized avatar
🎧
Listening to Africa by Toto

pwlin pwlin

🎧
Listening to Africa by Toto
View GitHub Profile
' regsvr32 wsh
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run "regsvr32.exe c:\windows\system32\whatever.dll"
<?php
// google feed api
$url = "http://rss.cnn.com/rss/cnn_topstories.rss";
//$data = file_get_contents("http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&output=json&q=$url");
$data = file_get_contents("http://www.google.com/uds/Gfeeds?num=5&hl=en&output=json&q=$url&v=1.0&nocache=0");
$data = json_decode($data);
var_dump($data);
<?php
ini_set('post_max_size','11M');
ini_set('upload_max_filesize','10M');
?>
<?php
private function disable_register_globals(){
if(ini_get('register_globals')){
foreach(get_defined_vars() as $var=>$val){
if(!in_array($var,array('_GET','_POST','_COOKIE','_SERVER'))){
unset($$var);
}
}
}
}
<?php
private function disable_magic_quotes(){
if(ini_get('magic_quotes_gpc')){
function strip_all_params(&$item){ $item = stripslashes($item); }
array_walk_recursive($_GET,'strip_all_params');
array_walk_recursive($_POST,'strip_all_params');
}
}
var deltatime = 24 * 60 * 60; // 24h
var last = GM_getValue("lastcheck", new Date().getTime() / 1000);
if (new Date().getTime() / 1000 - last > deltatime) {
checkUpdates();
GM_setValue("lastcheck", Math.round(new Date().getTime() / 1000));
}
function urlParam(name, _default) {
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]")
var regexS = "[\\?&]" + name + "=([^&#]*)"
var regex = new RegExp(regexS)
var results = regex.exec(window.location.href)
if (results == null) {
return _default
}
else {
return results[1]
<?php
// filter_input examples
// Make sure it is an integer
$integer = filter_input(INPUT_POST, 'variable_name', FILTER_SANITIZE_NUMBER_INT);
// Make it safe to use in a URL
$url_string = filter_input(INPUT_POST, 'variable_name', FILTER_SANITIZE_ENCODED);
// Make sure it is a valid URL
svn resolve --accept working -R .
<?php
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(dirname(__FILE__))) as $item) {
if (!$item->isDir() || $item->isDot()) continue;
echo $item, PHP_EOL;
}
?>