Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@iamsilvio
iamsilvio / PdfFilePrinter.cs
Created October 20, 2012 22:46
Print PDFs with Adobe Acrobat Reader from c#
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Microsoft.Win32;
namespace skat.Printserver
{
/// <summary>
/// A wrapper around Adobe Acrobat Reader that helps to print PDF files.
@iamsilvio
iamsilvio / gist:4529535
Created January 14, 2013 11:43
add a thumbnail Photo to a AD User
$photo = [byte[]](Get-Content d:\port300.png -Encoding byte)
Set-ADUser SAMACCOUNTNAME -Replace @{thumbnailPhoto=$photo}
@iamsilvio
iamsilvio / removecompletedtorrents.sh
Last active December 13, 2015 19:28 — forked from bulljit/removecompletedtorrents.sh
F: Added prowl support
#!/bin/sh
# script to check for complete torrents in transmission folder, then stop and move them
# either hard-code the MOVEDIR variable here…
MOVEDIR=/media/tc/downloads # the folder to move completed downloads to
# …or set MOVEDIR using the first command-line argument
# MOVEDIR=%1
AUTH="PWD"
USER="USER"
# And push a message to PROWL
# Fill in with your own API key here
@iamsilvio
iamsilvio / enforce-message.py
Last active December 14, 2015 05:49
Mercurial commit message hook B: fixed Changegroup handling
import re
def checkMessage(message):
"""
Checks if the message content matches one of the message rules
B: <message>
R: <message>
F: <message>
S: <message>
Merge
@iamsilvio
iamsilvio / prow_push.py
Created March 23, 2013 12:59
quick and dirty prowl push with proxy (keep care to specify a real exception to catch and log if needed)
import urllib
import urllib2
API_URL = 'https://api.prowlapp.com/publicapi/add'
API_KEY = 'xxxxxxxxxxxxxxxxxxx'
PROXY = 'xxx.xxx.xxx.xxx:xxxx'
def push():
@iamsilvio
iamsilvio / prowlHandler.py
Created May 13, 2013 14:05
a loggingHandler for Python to send notifications via the Prowl API
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
class ProwlHandler(logging.Handler):
"""
A handler class which sends a Prowl notification for each logging event.
"""
@iamsilvio
iamsilvio / mm-doe.css
Last active March 9, 2021 10:37
MarkdownPad 2 Dark CSS Preview: look at the first comment because Gist descriptions does not support links! Multi Markdown
/* DeleteOnError stylesheet for MarkdownPad (http://markdownpad.com) */
/* Author: Silvio Katzmann - http://deleteonerror.com */
/* Version: */
/* Source: */
/* --------------------------------------------------------------------RESET */
html, body, div, span, applet, object, iframe, p, blockquote, pre, a, abbr,
acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul,
@iamsilvio
iamsilvio / sort_images.py
Created June 7, 2013 11:27
dirty python script using PIL to remove black pictures from a Folder and tag each picture with a date string from file name! I have used It one time for 60.000 jpg and it works fine. Please do not use this code as a sample of good python code :)
from shutil import move
import os
from sys import stdout
from datetime import datetime
from time import time
from PIL import ImageFont, Image, ImageDraw
img_number = 1
black_images = 0
@iamsilvio
iamsilvio / Default (Linux).sublime-keymap
Last active December 19, 2015 08:09 — forked from coldnebo/Default (Linux).sublime-keymap
Changed Tidy xml to work with Sublime Text 3 Beta 3047 Added Some error output to the console
[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" }
]
@iamsilvio
iamsilvio / commit-msg
Created July 10, 2013 10:19
git commit-msg hook to reject bad formated messages
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import re
def checkMessage(msg):
"""
Checks if the message content matches one of the message rules
B: <message>