Skip to content

Instantly share code, notes, and snippets.

@DosAmp
DosAmp / gist:868276
Created March 13, 2011 17:28
Simple VBscript to toggle IE proxy usage
Dim wsh, enabled, antwort
Const PROXY_KEYNAME = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable"
Set wsh = WScript.CreateObject("WScript.Shell")
enabled = wsh.RegRead(PROXY_KEYNAME)
dialogText = "Die Proxynutzung ist "
If enabled = 0 Then
dialogText = dialogText & "deaktiviert." & vbCrLf & _
@DosAmp
DosAmp / gist:913635
Created April 11, 2011 14:49
Autofire script for semiautomatic Source weapons
// autofire.cfg: DosAmp's simple autofire script
/// core autofire functionality
alias +attack_af "alias do_af af; do_af"
alias -attack_af "alias do_af -attack"
// adapt "wait 4" for desired fire delay (in frames)
alias af "+attack; wait; -attack; wait 4; do_af"
/// autofire toggle switch
@DosAmp
DosAmp / gist:951489
Created May 2, 2011 11:41
Auto-updater cron script for BOINC projects
#!/bin/sh
# /etc/cron.hourly/boinc-update: forces all BOINC projects to update regularly
RPC_AUTH_FILE=/var/lib/boinc-client/gui_rpc_auth.cfg
# sometimes: RPC_AUTH_FILE=/var/lib/boinc/gui_rpc_auth.cfg
# in Debian: RPC_AUTH_FILE=/etc/boinc-client/gui_rpc_auth.cfg
RPC_AUTH=
if [ -r $RPC_AUTH_FILE ] && [ -s $RPC_AUTH_FILE ]; then
RPC_AUTH=`cat $RPC_AUTH_FILE`
@DosAmp
DosAmp / resize_mc.c
Created July 17, 2011 13:38
Windows tool for resizing Minecraft to a specific frame size
#include <windows.h>
#define MC_LAUNCHER_WINDOW_TITLE L"Minecraft Launcher"
#define MC_GAME_WINDOW_TITLE L"Minecraft"
#define TARGET_WIDTH 432
#define TARGET_HEIGHT 240
// method by Guy Lecky-Thompson
// http://www.suite101.com/content/client-area-size-with-movewindow-a17846
@DosAmp
DosAmp / gist:1099630
Created July 22, 2011 15:06
Central European Timezone snippet for times when you have no control over /etc/TZ or /etc/timezone
cetz() {
LANG=C
# current year
YEAR=`date +%Y`
# current time stamp
NOW=`date +%s`
# transition day for Central European Summer Time
LAST_SUNDAY_OF_MARCH=`cal 3 $YEAR | sed '/^$/d' | tail -n 1 | cut -d ' ' -f 1`
# transition day for Central European Time
@DosAmp
DosAmp / offline_launcher.bat
Created July 20, 2012 11:28
Launch Minecraft in offline mode with user name different from "Player"
@echo off
set username=DosAmp
cd /D %appdata%\.minecraft
start javaw -Xms512m -Xmx1024m -cp bin/lwjgl.jar;bin/lwjgl_util.jar;bin/jinput.jar;bin/minecraft.jar -Djava.library.path="%appdata%\.minecraft\bin\natives" net.minecraft.client.Minecraft "%username%"
@DosAmp
DosAmp / unhtml.c
Created November 20, 2012 10:33
Rename files with URL escape codes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
/* pop culture test case:
./unhtml "Gangnam+Style+(%EA%B0%95%EB%82%A8%EC%8A%A4%ED%83%80%EC%9D%BC).mp4"
*/
/* fix Windows macros */
@DosAmp
DosAmp / windowtoggle.c
Last active December 10, 2015 06:59
Windows console tool for toggling visibility of windows
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <windows.h>
#include <tchar.h>
#if defined(_UNICODE) && !defined(UNICODE)
#define UNICODE
#endif
@DosAmp
DosAmp / gpgwrapper.ps1
Last active December 19, 2015 11:39
Small drag-and-drop wrapper script for GnuPG
$gpgid = "DEADBEEF" # recipient ID (hex/email)
# add full path to binaries if needed
$gpgcommand = "gpg2"
$7zcommand = "7z"
foreach ($file in $args) {
$source = Get-Item -ErrorAction:SilentlyContinue $file
if ($source) {
if (-not $source.PSIsContainer) {
# file encryption/decryption
@DosAmp
DosAmp / store_titles.py
Last active September 6, 2017 05:53
Parse output of `pm list packages -f` on Android
import fileinput
import re
import http.client
import html.parser
URI_PREFIX = '/store/apps/details?id='
REGEXP_JAVA_PACKAGE = r"(?P<pkg>([a-z_][a-z0-9_]*(\.[a-z_][a-z0-9_]*)*))$"
REGEXP_PACKAGE_LIST = r"package:(?P<path>/.*\.apk)=" + REGEXP_JAVA_PACKAGE
#REQUEST_HEADERS = {'Accept-Language': 'en'}