Skip to content

Instantly share code, notes, and snippets.

View pwaldhauer's full-sized avatar
🎯
Focusing

Philipp Waldhauer pwaldhauer

🎯
Focusing
View GitHub Profile
@pwaldhauer
pwaldhauer / query.sql
Created January 14, 2015 22:20
Most liked blogposts
SELECT p.guid, CAST(pm.meta_value AS UNSIGNED) as abc FROM `wp_postmeta` AS `pm`
left join wp_posts AS p ON pm.post_id = p.id
where
p.post_date between '2014-01-01' and '2015-01-01'
and
pm.meta_key = 'like_count'
<?php
function array_swap(&$array,$swap_a,$swap_b){
list($array[$swap_a],$array[$swap_b]) = array($array[$swap_b],$array[$swap_a]);
}
$zwerge = [5, 5, 5, 5, 5, 8, 8, 8, 8, 8];
shuffle($zwerge);
print_r($zwerge);
- (void)viewWillLayoutSubviews {
[super viewWillLayoutSubviews];
self.topLayoutConstraint.constant = -1 * self.topLayoutGuide.length;
}
@pwaldhauer
pwaldhauer / make_webvideo.sh
Created September 15, 2014 15:45
Create HTML5 <video> tag-ready videos and a poster screenshot.
#!/bin/bash
echo "MP4"
#ffmpeg -i $1 -vcodec libx264 -vprofile slow -vprofile baseline -b:v 1500k -b:a 64k -g 30 $1.mp4
ffmpeg -i $1 -vcodec libx264 -vprofile slow -vprofile baseline -b:v 1500k -an -g 30 $1.mp4
echo "webm (VP8 / Vorbis)"
#ffmpeg -i $1 -b:v 1500k -b:a 64k -vcodec libvpx -acodec libvorbis -f webm -g 30 $1.webm
ffmpeg -i $1 -b:v 1500k -b:a 64k -vcodec libvpx -an -f webm -g 30 $1.webm
@pwaldhauer
pwaldhauer / ffmpeg.sh
Created July 2, 2014 11:43
Create youtube-ready h264 from jpegs
x=1; for i in *jpg; do counter=$(printf %03d $x); ln "$i" /tmp/aaa/img"$counter".jpg; x=$(($x+1)); done
ffmpeg -f image2 -framerate 25 -pattern_type sequence -r 10 -i img%03d.jpg -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p /Users/pwaldhauer/test.mp4
var casper = require('casper').create({
pageSettings: {
loadImages: false,
loadPlugins: false
},
logLevel: "info",
verbose: true
});
casper.start('https://kreditkarten-banking.lbb.de/Amazon/cas/dispatch.do?bt_PRELON=do&ref=1200_AMAZON&service=COS', function() {
import sublime, sublime_plugin
BLOCKLEN = 4
class TypeFileOutCommand(sublime_plugin.TextCommand):
def nextchar(self):
if self.body:
totype = []
while 1:
try:
export PROJECT_DIRECTORY="/Users/pwaldhauer/Dropbox/dev/Tests/"
function spawn_project {
if [ -z $2 ]
then
echo "You need a project name!"
return
fi
if [ $1 = "node" ]
@pwaldhauer
pwaldhauer / amazon.rb
Created February 1, 2012 23:24
Amazon Bestellungen Grabber
require 'rubygems'
require 'mechanize'
a = Mechanize.new { |agent|
agent.user_agent_alias = 'Mac Safari'
}
a.get('http://amazon.de/') do |page|
login_page = a.click(page.link_with(:text => 'Melden Sie sich an'))