Skip to content

Instantly share code, notes, and snippets.

pwlin pwlin

Block or report user

Report or block pwlin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pwlin
pwlin / gist:246467
Created Dec 1, 2009
Ajax with ActiveX WinHTTP 5.1
View gist:246467
// http://msdn.microsoft.com/en-us/library/aa384273(VS.85).aspx
function test_ajax(){
var ajax = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
/*
// Define the constants used by the option property.
const WinHttpRequestOption_UserAgentString = 0; // Name of the user agent
const WinHttpRequestOption_URL = 1; // Current URL
const WinHttpRequestOption_URLCodePage = 2; // Code page
@pwlin
pwlin / gist:246475
Created Dec 1, 2009
Calling PHP CLI from ActiveX FSO and WScript.Shell
View gist:246475
var php = {
cmd : function(command, nWindowType){
// Obtain a Temporary File Name
var oFS ;
var RunOutput = '' ;
oFS = new ActiveXObject("Scripting.FileSystemObject");
var cFile ;
cFile = oFS.GetSpecialFolder(2).Path+'\\'+ oFS.GetTempName() ;
// Execute the command and redirect the output to the file
@pwlin
pwlin / gist:246480
Created Dec 1, 2009
Convert PHP $argv to $_GET
View gist:246480
<?php
if ($argv) {
foreach ($argv as $k=>$v){
if ($k==0) continue;
$it = explode("=", $v);
if (isset($it[1])) {
$_GET[$it[0]] = $it[1];
}
}
}
@pwlin
pwlin / gist:246483
Created Dec 1, 2009
javascript dispatch mouse event
View gist:246483
var button = document.evaluate("//button[text()='archive']", document, null, XPathResult.ANY_TYPE,null).iterateNext();
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
button.dispatchEvent(evt);
@pwlin
pwlin / gist:255567
Created Dec 13, 2009
xp style for WebBrowser Control
View gist:255567
<meta http-equiv="MSThemeCompatible" content="Yes">
@pwlin
pwlin / gist:260001
Created Dec 19, 2009
building Darwin Streaming Server
View gist:260001
#!/bin/bash
# http://cwshep.blogspot.com/2008/08/darwin-streaming-server-603-on-linux.html
sudo apt-get install build-essential wget
sudo addgroup --system qtss
sudo adduser --system --no-create-home --ingroup qtss qtss
wget http://static.macosforge.org/dss/downloads/DarwinStreamingSrvr6.0.3-Source.tar
tar -xvf DarwinStreamingSrvr6.0.3-Source.tar
mv DarwinStreamingSrvr6.0.3-Source DarwinStreamingSrvr6.0.3-Source.orig
@pwlin
pwlin / gist:261182
Created Dec 21, 2009
Reads ID3v1 from a MP3 file
View gist:261182
<?php
// http://www.go4expert.com/forums/showthread.php?t=267
//Reads ID3v1 from a MP3 file and displays it
$mp3 = "1.mp3"; //MP3 file to be read
//make a array of genres
$genre_arr = array("Blues","Classic Rock","Country","Dance","Disco","Funk","Grunge",
"Hip-Hop","Jazz","Metal","New Age","Oldies","Other","Pop","R&B",
View process.js
// Mozilla - Run an external process
var fileExe = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
fileExe.initWithPath("c:\\windows\\explorer.exe");
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(fileExe);
var args = [] ;
/*
var args = new Array();
View XUL drop down menu without indicator
<!-- XUL drop down menu without indicator -->
<popupset>
<menupopup position="after_start" id="testPopup">
<menuitem label="test"/>
</menupopup>
</popupset>
<button label="test" type="menu" popup="testPopup"
View gist:358925
// Manual Geolocation provider for Firefox
// about:config geo.wifi.url file://
{"location": {
"latitude": 48.777025000000002,
"longitude": 9.1713909999999998,
"accuracy": 10.0}}
You can’t perform that action at this time.