Skip to content

Instantly share code, notes, and snippets.

@hostage
hostage / ChangeWallpaper.cmd
Created July 21, 2012 09:34
Change Windows wallpaper from a shell script
REG ADD "HKCU\Control Panel\Desktop" /V Wallpaper /T REG_SZ /F /D "%USERPROFILE%\Wallpaper.bmp"
REG ADD "HKCU\Control Panel\Desktop" /V WallpaperStyle /T REG_SZ /F /D 0
REG ADD "HKCU\Control Panel\Desktop" /V TileWallpaper /T REG_SZ /F /D 0
start /MIN /B %SystemRoot%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
@hostage
hostage / ScriptWrapper.c
Created July 21, 2012 09:22
Start a Windows console application without getting a pop-up command shell.
#include <windows.h>
/*
We define WinMain to simply run the user's command line; this is nothing they
couldn't already do via Windows+Run. It is useful if you want to prevent any
console windows from appearing on the user's desktop.
We wait for the process to exit and return the exit code to the caller.
@param hInstance Not used; o/s module handle for current process.
@hostage
hostage / ChangeFileAssociation.reg
Created July 16, 2012 04:35
Registry hack to open files without extensions in Notepad++
;
; For Windows 7 use ChangeFileAssociationV5.reg instead, this version only
; works for older versions of REGEDIT
;
[HKEY_CLASSES_ROOT\.]
@="Notepad++_file"
; Note: Notepad++ doesn't make the "Notepad++_file" registry key until you run
; as Administrator and manually add at least one other file association.
@hostage
hostage / local_httpd.py
Created February 21, 2012 06:25
Simple python snippet to serve files via http from the current folder. Automatically opens a browser pointed at the root url as a convenience.
# Launch an http server on localhost using a random port to serve files from
# the current working folder. Automatically open a web browser pointed at the
# root url as a convenience.
from SimpleHTTPServer import SimpleHTTPRequestHandler
from BaseHTTPServer import HTTPServer
import webbrowser
# Create a localhost server, specify port 0 so it will pick one for us.
httpd = HTTPServer(("localhost", 0), SimpleHTTPRequestHandler)