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:8a0d01e6428b7a96e2eb
Last active May 4, 2024 07:08
Android : add cert to system store
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 / tunneling.md
Created October 15, 2023 17:20 — forked from tombowditch/tunneling.md
Tunneling a whole process through wireguard

Tunneling a whole process through wireguard

Certain company blocking a certain hosting provider? No problem, just tunnel the process through a small VPS with wireguard.

Consider server A your blocked server and server B your VPS.

Step 1: Generate a keypair on server A and server B

Server A:

@pwlin
pwlin / gist:602454
Created September 29, 2010 08:21
Open URL in default browser
function openURLInDefaultBrowser(url){
var shell = new ActiveXObject('WScript.Shell');
shell.run(url);
}
// VBScript:
// Set shell = createobject("WScript.Shell")
// shell.run "http://www.microsoft.com"
@pwlin
pwlin / pm2-app.json
Created January 1, 2016 22:50
PM2 config example
{
"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 / gist:1248250
Created September 28, 2011 15:36
php custom encrypt/decrypt
<?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 / gist:4147863
Created November 26, 2012 12:02
google translate dropdown
<div id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
asar extract app.asar test
@pwlin
pwlin / electron-windows-store
Created August 19, 2020 13:56
electron-windows-store
electron-windows-store --input-directory "./in-folder" --output-directory "./out-folder" --package-version 1.0.0.0 --package-name PackageName
https://stackoverflow.com/a/58706318/374577
$ sudo parted /dev/sda resizepart 1
End? [20GB]? 40GB
$ sudo resize2fs /dev/sda1
$ lsblk
$ df -h
@pwlin
pwlin / html sample.html
Created October 26, 2011 13:27
webkit always show scrollbar (anti-Lion measures)
body { padding: 50px; }
ul {
max-height:300px;
overflow:auto;
}
/* Overwrite the default to keep the scrollbar always visible */