Skip to content

Instantly share code, notes, and snippets.

Avatar
🛠️
Tinkering

Michael Kropat mkropat

🛠️
Tinkering
View GitHub Profile
@mkropat
mkropat / DeleteQueue.bat
Last active Aug 29, 2015
Fast-delete the files in the delete queue
View DeleteQueue.bat
:: DeleteQueue.bat - Fast-delete the files in the delete queue
:: Instructions:
::
:: 1. Create the folder `C:\DeleteQueue`
:: 2. Create a scheduled task to run this batch file every night
::
:: Now any (potentially large) files or folders you move into
:: `C:\DeleteQueue` (a nearly instantaneous operation) will be deleted
:: overnight, without interrupting your flow.
@mkropat
mkropat / tun0
Last active Aug 29, 2015
OpenVPN integration with interfaces(5)
View tun0
iface tun0 inet manual
pre-up openvpn --mktun --dev tun0
up openvpn --config /etc/openvpn/YOURVPN.ovpn \
--daemon \
--dev tun0 \
--route-noexec \
--script-security 2 \
--route-up /etc/openvpn/on-route-up \
--writepid /var/run/openvpn.tun0
down /etc/openvpn/kill-service -w /var/run/openvpn.tun0
@mkropat
mkropat / maintain-links.ps1
Created Sep 12, 2014
Automatically maintain shortcuts to files in subdirectories
View maintain-links.ps1
@mkropat
mkropat / appscp.ps1
Last active Aug 29, 2015
appscp.ps1 boxstarter script
View appscp.ps1
# Run from Command Prompt:
# START http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/mkropat/e93b7bdaa04c2d56879b/raw/9eff96cf4aad061f60de314b9d973d3add278002/appscp.ps1
Set-WindowsExplorerOptions -EnableShowFileExtensions
cinst 7zip.install
cinst GoogleChrome
cinst linqpad4.install
cinst mysql
@mkropat
mkropat / delayer.js
Last active Aug 29, 2015
Sketch of a function to add artificial delays to XHRs
View delayer.js
function wrapInDelay(obj, methodName, delay) {
initialize();
wrapMethod(obj, methodName, function (method, args) {
window._delayerWantsDelay = delay;
var result = method.apply(this, args);
delete window._delayerWantsDelay;
return result;
});
View redirect-debug.php
<?php
header('Debug-Trace-'.substr(microtime(),0,8).': ' . json_encode(debug_backtrace()));
// Then in your browser just run
//
// console.log(JSON.stringify(<PASTE TRACE HERE>, null, 4))
@mkropat
mkropat / delete-temp-aspnet.ps1
Created Jan 14, 2015
Delete all files in 'Temporary ASP.NET Files' at boot
View delete-temp-aspnet.ps1
# delete-temp-aspnet.ps1
#
# Delete all files in 'Temporary ASP.NET Files' at boot
param(
[switch] $Clean,
[switch] $Register
)
if ($Register) {
View set-ie-proxy.ps1
$setProxy = {
param($proxy)
Set-Location 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings'
Set-ItemProperty . ProxyServer $proxy
Set-ItemProperty . ProxyOverride '<local>'
Set-ItemProperty . ProxyEnable 1
}
# You can run $setProxy as another user like so:
#
View minecraft.conf
# description "minecraft server"
start on runlevel [345]
stop on runlevel [^345]
console log
chdir /var/lib/minecraft/
setuid minecraft
setgid minecraft