Skip to content

Instantly share code, notes, and snippets.


Arnold Daniels jasny

View GitHub Profile
jasny / static-redirect-wordpress.php
Created Jun 28, 2015
Add redirects to WordPress posts using static HTML pages
View static-redirect-wordpress.php
/* This script can to be used when your replacing your WordPress site with
* a static site, while keeping your blog on WordPress.
* Make sure you increase the number of syndicated posts to include all posts
* in Settings > Reading on your WordPress blog.
if ($argc < 2) {
jasny / HTMLToXMLFilter.php
Created Jun 26, 2014
Stream filter to convert HTML5 to XML
View HTMLToXMLFilter.php
* Stream filter to convert HTML5 to XML.
* <code>
* $dsn = "php://filter/read=htmltoxml/resource=" . $url;
* $xml = XMLReader::open($dsn);
* </code>
TABLES=`echo "SHOW TABLES IN $1;" | mysql -NB`
jasny / flip.js
Created Mar 27, 2014
Turn text upside down with JavaScript
View flip.js
//this script is based on coding by Reverse Fad
function flip() {
var result = flipString(document.f.original.value.toLowerCase());
document.f.flipped.value = result;
function flipString(aString) {
var last = aString.length - 1;
var result = new Array(aString.length)
for (var i = last; i >= 0; --i) {
var c = aString.charAt(i)
jasny / bootstrap-em.less
Last active Jan 5, 2020
Use em or rem font-size in Bootstrap 3
View bootstrap-em.less
* Use em or rem font-size in Bootstrap 3
@font-size-root: 14px;
@font-unit: 0rem; // Pick em or rem here
// Convert all variables to em
jasny / 000-default.conf
Last active Aug 29, 2015
Apache2 localhost
View 000-default.conf
<VirtualHost *:80>
ServerName localhost
DocumentRoot /home/arnold/Projects/
<Directory />
Options FollowSymLinks
AllowOverride None
<Directory /home/arnold/Projects/>
Options Indexes FollowSymLinks
jasny / install-git-hooks
Last active Jan 2, 2016
Define git hooks within your repository. Allows defining multiple scripts for one hook.
View install-git-hooks
HOOK_NAMES="applypatch-msg pre-applypatch post-applypatch pre-commit prepare-commit-msg commit-msg post-commit pre-rebase post-checkout post-merge pre-receive update post-receive post-update pre-auto-gc"
HOOK_DIR=$(git rev-parse --show-toplevel)/.git/hooks
DIR=$(dirname "$0")
for hook in $HOOK_NAMES; do
# If the hook already exists, is executable, and is not a symlink
if [ ! -h "$HOOK_DIR/$hook" -a -x "$HOOK_DIR/$hook" ]; then
mv "$HOOK_DIR/$hook" "$HOOK_DIR/$hook.local"
jasny / .htaccess
Last active Dec 28, 2015
URL shortener
View .htaccess
RewriteEngine On
RewriteRule ^(\w{5})$ /index.php?key=$1
jasny /
Last active Dec 13, 2015
GTK interface to start openvpn
CONFIG=$(zenity --file-selection --file-filter='*.opvn' --title="Select openvpn config file")
[ -n "$CONFIG" ] || exit 1
cd $(dirname "$CONFIG")
gksudo /usr/sbin/openvpn $CONFIG
jasny / image-embed-html.php
Created Oct 23, 2012
Create base64 encoded image to embed in HTML
View image-embed-html.php
$files = array_slice($argv, 1);
foreach ($files as $file) {
$picture = file_get_contents($file);
$size = getimagesize($file);
// base64 encode the binary data, then break it into chunks according to RFC 2045 semantics
$base64 = chunk_split(base64_encode($picture));