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
if (Environment.OSVersion.Version.Major >= 6)
{
SetProcessDPIAware();
}
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();
<?php
$realm = 'Restricted area';
//user => password
$users = array('admin' => 'mypass', 'guest' => 'guest');
if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Digest realm="'.$realm.'",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');
@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:

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
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 November 1, 2024 07:50
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>