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
@pwlin
pwlin / gist:9068069
Last active June 26, 2019 21:07
nodejs open external program
function testExternalApp(){
//////////////////////////////////
// http://stackoverflow.com/questions/18183882/node-webkit-how-to-execute-an-exe-file
// https://github.com/rogerwang/node-webkit/wiki/Clipboard
var execFile = require('child_process').execFile, child;
child = execFile('C:\\Program Files\\Microsoft Office\\Office12\\winword.exe', function(error,stdout,stderr) {
if (error) {
//console.log(error.stack);
@pwlin
pwlin / gist:f0cd4255c658760a0890
Created May 12, 2015 20:50
WScript.Shell automation
set WshShell = WScript.CreateObject("WScript.Shell")
sub shell(cmd)
dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run(cmd)
Set objShell = Nothing
end sub
shell """C:\Program Files\Internet Explorer\iexplore.exe"" https://accounts.google.com/ServiceLogin?service=mail&passive=true&continue=https://mail.google.com/mail/h/html"
@pwlin
pwlin / vlite old
Created September 21, 2010 12:29
vlite 1.16
http://www.hack7mc.com/2010/03/creating-a-windows-7-lite-for-media-center-users-with-vlite.html
Google around for vLite 1.16 and download this version
Download”Universal Extractor” to extract the setup for vLite 1.16
extract the WIM files from vLite 1.16 to your vLite1.2 installation folder.
For Windows x64 it should work fine. For windows x86 copy the WIMGAPI.Dll from the WAIK iso to your vLite folder.
Right-click on wimfiltr.inf and install after copying wimgapi.dll to vLite folder
iptables -t nat -A PREROUTING -p tcp --dport <origin-port-WAN> -j REDIRECT --to-port <destination-port-LAN>
service iptables save
service iptables restart
iptables -t nat --line-numbers -L
iptables -t nat -D PREROUTING <line-number>
@pwlin
pwlin / VirtualBox numlock weirdness
Last active May 17, 2017 13:05
virtualbox keyboard numlock problem
https://martinvanbeurden.nl/blog/virtualbox-numlock-weirdness/
VBoxManage setextradata "<machine-name>" GUI/HidLedsSync "0"
for /f "tokens=*" %G in ('dir /b /a:d ".\*"') do (VBoxManage setextradata "%G" GUI/HidLedsSync "0")
@pwlin
pwlin / gist:2bdbee3d5d3cc0072495a4acaaf7414f
Created November 2, 2016 08:33
windows explorer drag and drop bug
http://www.tenforums.com/general-support/6868-no-drag-drop-windows-explorer-other-oddities-post834171.html#post834171
Drag-drop in Explorer broke after I removed the Quick Access feature.
Found a fix today.... I think.
All under Registry HKEY_CLASSES_ROOT:
When I searched CLSID for "drag" I found this key: {4657278A-411B-11d2-839A-00C04FD918D0}
called "Shell Drag and Drop helper"
-- well that seems promising, no?
<div style="width:100%;display:flex;flex-flow:wrap;">
<div style="flex:1 100%;overflow:hidden;text-overflow:ellipsis;"></div>
<div style="width:50%"></div>
<div style="width:50%"></div>
</div>
"addon x" might slow firefox bar:
increase the value of browser.addon-watch.percentage-limit or browser.addon-watch.interval
var path = require('path');
var consolePath = path.join(path.dirname(process.execPath), 'NWHelper.exe');
console.log(consolePath);
var spawn = require('child_process').spawn;
var prc = spawn(consolePath, ['UserInfo.getLoggedInUserName']);
//noinspection JSUnresolvedFunction
document.addEventListener("DOMContentLoaded", function(event) {
init();
});
function init() {
var fs = require('fs');
fs.writeFile(process.execPath.replace('nw.exe', '') + 'test1.txt', 'hello hello', function(err) {
if (err) {
console.log(err);
}