Skip to content

Instantly share code, notes, and snippets.

View dessibelle's full-sized avatar
🦊
Yes

Simon Fransson dessibelle

🦊
Yes
View GitHub Profile
@dessibelle
dessibelle / chrome-osx-disable-ssl3-patch.sh
Created October 16, 2014 11:18
Chrome OS X POODLE patch
#!/usr/bin/env bash
BUNDLE_PATH="/Applications/Google Chrome.app"
APP_PATH="$BUNDLE_PATH/Contents"
PLIST_PATH="$APP_PATH/Contents/Info.plist"
EXECUTABLE_PATH="$APP_PATH/MacOS/Google Chrome"
EXECUTABLE_ARGS="--args --ssl-version-min=tls1"
LAUNCHER_SCRIPT_FILENAME="launch-chrome-tls.sh"
LAUNCHER_SCRIPT_PATH="$APP_PATH/MacOS/$LAUNCHER_SCRIPT_FILENAME"
@dessibelle
dessibelle / override-wptouch-urls.php
Created November 28, 2011 17:45
PHP: Override WPtouch's content_url function to make use of `content_url` instead of `WP_CONTENT_URL`.
<?php
/*
Plugin Name: Override WPtouch URLs
Plugin URI: http://dessibelle.se
Description: Overrides WPtouch's content_url function to make use of `content_url` instead of `WP_CONTENT_URL`.
Author: Simon Fransson
Version: 1.0
Author URI: http://dessibelle.se/
*/
@dessibelle
dessibelle / memroy-consumtion.php
Created February 25, 2012 11:54
PHP: Print WordPress memory consumption in footer
// Prints WordPress memory consumption in footer. Measured at script start, 'init', 'wp_head' and 'wp_footer'.
$start = memory_get_usage();
add_action('wp_head', create_function('', 'global $header; $header = memory_get_usage();'));
add_action('wp_head', create_function('', 'global $init; $init = memory_get_usage();'));
add_action('wp_footer', create_function('', 'global $start; echo "<pre>Start: " . number_format($start, 0, ".", ",") . " bytes</pre>\n";'));
add_action('wp_footer', create_function('', 'global $init; echo "<pre>Init: " . number_format($init, 0, ".", ",") . " bytes</pre>\n";'));
add_action('wp_footer', create_function('', 'global $header; echo "<pre>Header: " . number_format($header, 0, ".", ",") . " bytes</pre>\n";'));
add_action('wp_footer', create_function('', 'echo "<pre>End: " . number_format(memory_get_usage(), 0, ".", ",") . " bytes</pre>\n";'));
@dessibelle
dessibelle / keychain-dump.txt
Created March 1, 2012 12:55
TextMate search/replace regex for keychain dumps
# Dump keychain using: security dump-keychain /Path/to/keychain.keychain -d > keychain
# Open resulting file in TextMate. The following regex will strip out Name, Account, Protocol, Host and Password and wrap everything else in HTML comments which can be removed using Bundles > HTML > Strip HTML tags from document…
# Search for
(?m:attributes.*?0x00000007 <blob>="([^"]+).*?"?acct"<blob>="([^"]+).*?"ptcl"<uint32>="([^"]+).*?"srvr"<blob>="([^"]+).*?data:\n"([^"]+)".*?class:)
# Replace with
\n\n--><entry>Name: $1\nAccount: $2\nProtocol: $3\nHost: $4\nPassword: $5</entry><!--\n\n
@dessibelle
dessibelle / html5video.sh
Created June 20, 2012 07:50
Shell script: HTML5 Video Transcoding
#!/usr/bin/env bash
MISSING_DEPENDENCIES=false
command -v HandBrakeCLI >/dev/null 2>&1 || { echo >&2 "I require HandBrakeCLI but it's not installed."; MISSING_DEPENDENCIES=true; }
command -v ffmpeg2theora >/dev/null 2>&1 || { echo >&2 "I require ffmpeg2theora but it's not installed."; MISSING_DEPENDENCIES=true; }
if $MISSING_DEPENDENCIES ; then
echo >&2 ""
echo >&2 "Aborting."
@dessibelle
dessibelle / deploy.sh
Created September 18, 2012 15:48
Shell script: Deploy website
#!/usr/bin/env bash
# === Operation plan ===
#
# [ ] Support for different systems, using `find $SITE -name wp-config.php` for WordPress
# [ ] Add/read/set directives for environment DEVELOPMENT / STAGING / PRODUCTION in wp-config.php etc.
# [ ] Different database credentials etc. depending on environment
# [ ] Automatically change environment in wp-config.php etc. when deploying
# [*] Create some kind of .deploy_rc file to hold server settings (host, credentials, remote path etc.)
# and store inside site directory (is that really wise?)
@dessibelle
dessibelle / gist:6595023
Created September 17, 2013 14:24
Fix for missing activation hook in Taxonomy Order 1.1
--- orig.taxonomy-order.php 2013-09-17 16:18:19.000000000 +0200
+++ taxonomy-order.php 2013-09-17 16:18:50.000000000 +0200
@@ -86,7 +86,7 @@
self::$plugin_url = WP_PLUGIN_URL . '/' . self::$plugin_folder;
self::$plugin_file = self::$plugin_dir . '/taxonomy-order.php';
- register_activation_hook( self::$plugin_file, array( $this, 'activation_hook' ) );
+ // register_activation_hook( self::$plugin_file, array( $this, 'activation_hook' ) );
add_action( 'init', array($this, 'interface_wpdbfix') );
@dessibelle
dessibelle / jetpack-override.css
Created September 18, 2013 10:56
Example WordPress plugin to override CSS
/* CSS overrides goes here */
#some-elem .some-class {
display: none;
}
@dessibelle
dessibelle / ssh-transfer-key.sh
Last active December 23, 2015 17:29
Transfers your public SSH key (id_rsa.pub) to the authorized_keys file of a remote computer, allowing for password-less login.
#!/usr/bin/env bash
PROGRAM_NAME=`basename $0`
ARGS=`getopt u:H:h "$@"`
KEY_PATH=~/.ssh/id_rsa.pub
if [ $? != 0 ] ; then
echo "Error parsing arguments. Try $PROGRAM_NAME -h" > /dev/stderr
exit 2
@dessibelle
dessibelle / wp-mini-json-api.php
Last active December 23, 2015 19:19
Miniature JSON API for WordPress, returning posts of a specified post type in JSON format
<?php
class WPMiniJSONAPI {
const API_ACTION_QUERY_VAR = "my-api";
const API_PERMALINK_PART = "api";
const API_EVENTS_PERMLINIK_PART = "events";
const API_OUTPUT_FORMAT = "json";
const API_EXPORT_EVENTS = "export-events";