Skip to content

Instantly share code, notes, and snippets.

@errkk
errkk / gist:3763626
Created September 21, 2012 20:10
Term - taxonomy relationship SQL join for WP
SELECT * FROM wp_posts p
LEFT JOIN wp_term_relationships tr ON tr.object_id = p.ID
LEFT JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
LEFT JOIN wp_terms t ON t.term_id = tt.term_id
@errkk
errkk / gist:4706383
Created February 4, 2013 12:08
Move a WordPress blog from one host to another, so the permalinks work
SET @uri_from = 'www.devurl.local';
SET @uri_to = 'www.liveurl.net';
UPDATE wp_options SET `option_value` = REPLACE(`option_value`, @uri_from, @uri_to)
WHERE `option_value` LIKE CONCAT( "%", @uri_from, "%" );
UPDATE wp_posts SET `guid` = REPLACE(`guid`, @uri_from, @uri_to);
UPDATE wp_posts SET `post_content` = REPLACE(`post_content`, @uri_from, @uri_to);
@errkk
errkk / gist:4986422
Created February 19, 2013 14:33
Prep repo for pushing from Fabric
git init && git config receive.denyCurrentBranch ignore
@errkk
errkk / Famous people
Last active December 15, 2015 05:09
Famous people I have seen
(S) = Seen
(M) = Met
# Soho
(S) Jerry Springer
(S) Kyly Minogue
(S) Neil Morrissy
(S) Rod Stuart
(S) Lennie Henry
(S) Jack Whitehall x2
@errkk
errkk / gist:5237693
Last active December 15, 2015 09:19
How to find cat gifs when under comedy time pressure

Right click Chrome "Omnibar" and go to Edit Search Engines

Imgur

Add https://www.google.co.uk/search?tbm=isch&tbs=itp:animated&q=%s and call it a keyword like Gif Search and make sure its added to "Default Search Engines"

Quick need cat gif

Type gif then tab then your search terms

@errkk
errkk / gist:5690962
Last active December 17, 2015 23:39
Downloads latest frames from the Pi, updates the frame list, makes them into a video, and plays it!
rsync -avz [email protected]:/home/pi/mnt/ ~/Desktop/stills/ && find . -name '*.jpg' -size 0 -print0 | xargs -0 rm && ls *.jpg > stills.txt && mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1080:768 -o ~/Desktop/tl_london1.avi -mf type=jpeg:fps=48 mf://@stills.txt && mplayer ../tl_london1.avi
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@errkk
errkk / gist:6279024
Last active December 21, 2015 08:38
Composite a PNG over an input video frame by frame
avconv -i input.mp4 -f image2 frames/f_%00d.jpg
for F in $(ls frames/)
do
composite -compose atop -gravity SouthWest overlay_frame.png frames/$F out/$F
done
avconv -f image2 -i out/f_%00d.jpg out.mpeg -b 2400kb
@errkk
errkk / gist:7006532
Created October 16, 2013 11:52
Pusher Parrot
#include <SPI.h>
#include <Ethernet.h>
#include <PusherClient.h>
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
PusherClient client;
IPAddress ip(192,168,1,101);
const int parrot = 3;
@errkk
errkk / RadioSwitch.ino
Last active December 27, 2015 04:19
RadioSwitch
// See http://www.fanjita.org/serendipity/archives/53-Interfacing-with-radio-controlled-mains-sockets-part-2.html
#define PAYLOAD_SIZE 48
#define DATA_PIN A4
#define VCC_PIN A5
#define GND_PIN A3
#define LED_PIN 13
#define CHANNEL 1
#define TURNON 1