Skip to content

Instantly share code, notes, and snippets.

View mkropat's full-sized avatar
📚
Learning

Michael Kropat mkropat

📚
Learning
View GitHub Profile
@mkropat
mkropat / DeleteQueue.bat
Last active August 29, 2015 14:04
Fast-delete the files in the delete queue
:: 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 August 29, 2015 14:05
OpenVPN integration with interfaces(5)
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 September 12, 2014 15:53
Automatically maintain shortcuts to files in subdirectories
@mkropat
mkropat / appscp.ps1
Last active August 29, 2015 14:07
appscp.ps1 boxstarter script
# 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 August 29, 2015 14:11
Sketch of a function to add artificial delays to XHRs
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;
});
<?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))
--pager=less -RS
@mkropat
mkropat / delete-temp-aspnet.ps1
Created January 14, 2015 22:15
Delete all files in 'Temporary ASP.NET Files' at boot
# delete-temp-aspnet.ps1
#
# Delete all files in 'Temporary ASP.NET Files' at boot
param(
[switch] $Clean,
[switch] $Register
)
if ($Register) {
# description "minecraft server"
start on runlevel [345]
stop on runlevel [^345]
console log
chdir /var/lib/minecraft/
setuid minecraft
setgid minecraft
netsh interface ipv4 set dnsserver "Ethernet" source=dhcp