Skip to content

Instantly share code, notes, and snippets.

View wiesson's full-sized avatar

Arne Wiese wiesson

View GitHub Profile
@wiesson
wiesson / to_innodb.sql
Created March 22, 2016 16:20
Covert all tables to innodb;
SELECT CONCAT('ALTER TABLE ', TABLE_SCHEMA, '.', TABLE_NAME, ' engine=InnoDB;') FROM information_schema.TABLES WHERE ENGINE = 'MyISAM';
@wiesson
wiesson / xmas.py
Last active December 27, 2022 02:24
Aufgabe: Zahl1 - Zahl2 = 42137. Zahl1 und Zahl2 werden aus 1, 2, 3, 4, 5, 6, 7, 8 oder 9 gebildet, jede Zahl kommt nur einmal vor.
"""
Lsg:
43726 - 1589 = 42137
43789 - 1652 = 42137
47326 - 5189 = 42137
47398 - 5261 = 42137
"""
from random import shuffle
while True:
@wiesson
wiesson / README.md
Last active December 13, 2015 19:13 — forked from dwtkns/README.md
Faux-3d Shaded Globe

Faux-3d SVG globe using d3.geo.orthographic and a few radial gradients. Labels offset or hidden based on radians from current map center to enhance the effect.

Uncomment svg.append("g").attr("class","countries") for hover-able country outlines.

@wiesson
wiesson / README.md
Last active February 26, 2017 19:36
A simple d3 worldmap with own (merged) regions.

A d3 worldmap with own regions, defined by the iso 3166-1 (alpha-3) country code. Uses topojson.merge().

@wiesson
wiesson / index.php
Created November 27, 2015 15:08
Click 2 Call - XML RPC Example with PHP
<?php
if (!extension_loaded('xmlrpc')) {
echo "PHP xmlrpc extension is not available.";
die;
}
function call($remoteUri, $localUri, $username, $password)
{
$requestParameter = array(
'RemoteUri' => sprintf('sip:%[email protected]', $remoteUri),
@wiesson
wiesson / functions.php
Last active October 22, 2015 08:31
Responsive Wordpress Background Images
add_image_size('img-l', 1024, 702);
add_image_size('img-m', 768, 372);
add_image_size('img-s', 480, 320);
add_image_size('img-xs', 320, 200);
/**
* Get WP Attachment as responsive background image
* @param int $id
* @return string
*/
(moment('2015-04-25').add(6, 'months')).diff(moment(), 'days')
Game.goldenCookie.spawn();
var clickNormalCookie = setInterval(function(){ $('#bigCookie').click() }, 1);
var clickGoldenCookie = setInterval(function(){ Game.goldenCookie.time = Game.goldenCookie.maxTime; Game.goldenCookie.click(); }, 5);
// clear setInterval
clearInterval(clickNormalCookie);
clearInterval(clickGoldenCookie);
@wiesson
wiesson / get_attachment_from_eml.py
Created May 12, 2015 12:06
Separate attachments from mails files (*.eml) with Python 2/3
import glob
import email
if __name__ == '__main__':
files = glob.glob("/Users/wiesson/Downloads/mails/*.eml")
for each in files:
msg = email.message_from_file(open(each))
attachments = msg.get_payload()
for attachment in attachments:
try:
@wiesson
wiesson / functions.php
Last active August 29, 2015 14:17
Super simple responsive Wordpress gallery approach
function responsiveImages($string, $attr) {
$output = "<div id=\"responsive-gallery-test\">";
$posts = get_posts(array('include' => $attr['ids'], 'post_type' => 'attachment'));
foreach ($posts as $image) {
$output .= "<img data-img-small='" . wp_get_attachment_image_src($image->ID, 'thumbnail')[0] . "'" .
" data-img-medium='" . wp_get_attachment_image_src($image->ID, 'medium')[0] . "''" .
" data-img-large='" . wp_get_attachment_image_src($image->ID, 'large')[0] . "''" .
" data-img-full='" . wp_get_attachment_image_src($image->ID, 'full')[0] . "'/>";
}