Skip to content

Instantly share code, notes, and snippets.

View sinky's full-sized avatar

Marco Krage sinky

View GitHub Profile
@sinky
sinky / MigratePrinter.ps1
Created May 11, 2015 05:51
Migrate Printer from old Print Server to new Print Server with Powershell, maintain Default Printer.
$Printers = Get-WmiObject win32_printer
$oldPrintserver = "OLD_PRINTSERVER_HOSTNAME"
$newPrintserver = "NEW_PRINTSERVER_HOSTNAME"
foreach($oldPrinter in $Printers) {
Write-Host "Bearbeite Drucker: "$oldPrinter.Name
#if( $oldPrinter.Name.StartsWith("Microsoft XPS Document Writer") -Or $oldPrinter.Name.StartsWith("Fax") -Or $oldPrinter.Name.StartsWith("An OneNote 2010 Senden") ) {
# Write-Host "Lösche Drucker: "$oldPrinter.Name
# $oldPrinter.PSBase.Delete()
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@sinky
sinky / index.php
Created March 1, 2015 10:35
My own first CMS 2004-2005
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>my-azur.de</title>
</head>
<body>
<h1>my-azur.de</h1>
<?php
$site = $_GET['site'];
if (!isset($site)) {
### Keybase proof
I hereby claim:
* I am sinky on github.
* I am sinky (https://keybase.io/sinky) on keybase.
* I have a public key whose fingerprint is 7797 1CFD E497 A4FE 7674 61BF 510D FAAD BFB2 CB29
To claim this, I am signing this object:
@sinky
sinky / icloud_dump.php
Created April 27, 2014 13:26
iCloud Dump
<?php
require('class.sosumi.php'); // https://github.com/tylerhall/sosumi
$ssm = new Sosumi("ICLOUD_USER", "ICLOUD_PASS");
var_dump($ssm);
@sinky
sinky / simplifyed_script.js
Last active August 29, 2015 13:56
The way i load JS on my my-azur.de/blog/ (used in: https://my-azur.de/blog/javascript-hier-im-blog/)
// Pfad zum Wordpress Theme
var stylesheet_directory = "//my-azur.de/blog/wp-content/themes/azur";
// Existiert auf dieser Seite die gewünschte Tabelle
if($('.cinematiclist').length) {
// dann lade Script und führe Funktion aus
loadScript(stylesheet_directory+"/lib/jquery.tablePagination.js", function() {
$('.cinematiclist').tablePagination();
});
}
/**
*
* Here's a thing that will look through all the text nodes of a document, and
* upon encountering an emoji codepoint, will replace it with an image.
* For now, those images are pulled from GitHub, which isn't very nice, so I
* need to find a more suitable host.
*
* Much of this code was gleaned from staring at the minified GitHub JS.
*
* Copyright (c) 2013 Mark Wunsch. Licensed under the MIT License.
/* GCD */
function gcd (a, b) { return (b == 0) ? a : gcd (b, a%b); } // Source: http://stackoverflow.com/a/1186465
/* ratio is to get the gcd and divide each component by the gcd, then return a string with the typical colon-separated value */
function ratio(x,y) {c=gcd(x,y); return ""+(x/c)+":"+(y/c)}
ratio(1920,1080)
/* "16:9" */
ratio(320,240)
/* "4:3" */
@sinky
sinky / app.js
Last active January 2, 2016 02:18
QR Code Generator; Demo: http://bl.ocks.org/sinky/8235773
$(function() {
var data = location.hash.substring(1);
data = Base64.decode(data);
genQR(data);
$('#in').val(data);
$('#in').bind('keyup', function() {
var data = $(this).val();
genQR(data);
test