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:8a0d01e6428b7a96e2eb
Created Mar 7, 2016
Android : add cert to system store
View gist:8a0d01e6428b7a96e2eb
https://code.google.com/p/android/issues/detail?id=32696#c5
If you have a certificate that is not
trusted by Android, when you add it, it goes in the personal cert store.
When you add a cert in this personal cert store, the system requires a
higher security level to unlock the device. But if you manage to add your
cert to the system store then you don't have this requirement. Obviously,
root is required to add a certificate to the system store, but it is quiet
easy.
@pwlin
pwlin / gist:1248250
Created Sep 28, 2011
php custom encrypt/decrypt
View gist:1248250
<?php
function encrypt($string, $key=5) {
$result = '';
for($i=0, $k= strlen($string); $i<$k; $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key))-1, 1);
$char = chr(ord($char)+ord($keychar));
$result .= $char;
}
return base64_encode($result);
@pwlin
pwlin / pm2-app.json
Created Jan 1, 2016
PM2 config example
View pm2-app.json
{
"apps" : [{
"name" : "worker-app",
"script" : "worker.js",
"args" : ["--toto=heya coco", "-d", "1"],
"watch" : true,
"node_args" : "--harmony",
"merge_logs" : true,
"cwd" : "/this/is/a/path/to/start/script",
"env": {
@pwlin
pwlin / html sample.html
Created Oct 26, 2011
webkit always show scrollbar (anti-Lion measures)
View html sample.html
body { padding: 50px; }
ul {
max-height:300px;
overflow:auto;
}
/* Overwrite the default to keep the scrollbar always visible */
@pwlin
pwlin / gist:9068069
Last active Jun 4, 2018
nodejs open external program
View gist:9068069
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
WScript.Shell automation
View gist:f0cd4255c658760a0890
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"
View vlite old
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
View gist:ea7258ebaeea79d7f5b8d7350c73934f
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
virtualbox keyboard numlock problem
View VirtualBox numlock weirdness
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 Nov 2, 2016
windows explorer drag and drop bug
View gist:2bdbee3d5d3cc0072495a4acaaf7414f
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?
You can’t perform that action at this time.