This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes, sys | |
from ctypes import windll, wintypes | |
from uuid import UUID | |
class GUID(ctypes.Structure): # [1] | |
_fields_ = [ | |
("Data1", wintypes.DWORD), | |
("Data2", wintypes.WORD), | |
("Data3", wintypes.WORD), | |
("Data4", wintypes.BYTE * 8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
class UserNotFound(Exception): pass | |
### Windows ### | |
if os.name == 'nt': | |
import ctypes | |
from ctypes import windll, wintypes | |
class WinError: # [1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import json, sys | |
if len(sys.argv) < 2 or sys.argv[1] == '-': | |
f = sys.stdin | |
else: | |
f = open(sys.argv[1]) | |
json.dump(json.load(f), sys.stdout, indent=4, separators=(',', ': ')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' datetime.vbs | |
' Print out various ways of getting date and time information in VBScript | |
' running under Windows Scripting Host (WSH). | |
' Usage: > cscript.exe /nologo datetime.vbs | |
Dim wmi : Set wmi = GetObject("winmgmts:root\cimv2") | |
Dim n : n = #2/29/2016 1:02:03 PM# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>jQuery deferreds and promises - .then() vs .done()</title> | |
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css"> | |
</head> | |
<body> | |
<p> | |
A study in jQuery deferreds, based on <em>Lu4's</em> <a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once( dirname(__FILE__) . '/wp-load.php' ); | |
require_once( ABSPATH . WPINC . '/registration.php' ); | |
require_once( ABSPATH . '/wp-includes/pluggable.php' ); | |
require_once( ABSPATH . '/wp-includes/general-template.php' ); | |
require_once( ABSPATH . '/wp-includes/capabilities.php' ); | |
if ($_POST) { | |
if ($user = get_userdatabylogin($_REQUEST['username'])) { // FIXME: doesn't work | |
wp_update_user(array("ID" => $user->ID, "user_pass" => $_REQUEST['password'])); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
$serialized = file_get_contents($argv[1]); | |
$obj = unserialize($serialized); | |
$json_obj = json_encode($obj, JSON_PRETTY_PRINT); | |
echo "$json_obj\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[parameter(Mandatory=$true, Position=0)] | |
[String[]] $Path, | |
[Switch] $Watch | |
) | |
function main | |
{ | |
Remove-InvalidShortcuts |
OlderNewer