Skip to content

Instantly share code, notes, and snippets.

View jasny's full-sized avatar

Arnold Daniels jasny

View GitHub Profile
@jasny
jasny / 000-default.conf
Last active August 29, 2015 13:56
Apache2 localhost
<VirtualHost *:80>
ServerName localhost
DocumentRoot /home/arnold/Projects/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/arnold/Projects/>
Options Indexes FollowSymLinks
#!/bin/sh
OLD_DB=$1
NEW_DB=$2
TABLES=`echo "SHOW TABLES IN $1;" | mysql -NB`
IFS="
"
@jasny
jasny / static-redirect-wordpress.php
Created June 28, 2015 12:18
Add redirects to WordPress posts using static HTML pages
<?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
jasny / class_casting.php
Created March 28, 2012 04:39
Class casting in PHP (very dirty, not for production)
<?php
/**
* Parent class
*/
class mother
{
protected $myvar;
function __construct($value)
@jasny
jasny / gist:3766751
Created September 22, 2012 16:55
Logitech Performance Mouse MX - thumb button as middle-mouse
#!/bin/bash
for ID in $(xinput list | grep "Logitech Unifying Device" | perl -pe 's/^.*?id=(\d+).*$/\1/'); do
xinput set-button-map $ID 1 2 3 4 5 6 7 8 9 2 11 12 13 14 15 16 17 18 19 20 2>/dev/null | true;
done
@jasny
jasny / gist:3766752
Created September 22, 2012 16:56
Bash Aliases
function mvdown { mv "$1" /tmp/_mvdown_; rmdir $(dirname "$1"); mv /tmp/_mvdown_ $(dirname "$1"); }
@jasny
jasny / Autoloader.php
Created October 19, 2012 14:38
Autoloader for PHP
<?php
/**
* A very simple autoloader
*/
class Autoloader
{
/**
* Only use this class statically.
* @ignore
@jasny
jasny / aws-setup.md
Created November 9, 2015 19:47
A simple guide on installing the AWS cli including how to obtain an access key

AWS cli

Installation

To use the AWS and Elastic Beanstalk command line application, you need to install them using the Python package installer pip.

sudo pip install awscli awsebcli

Creating access keys

@jasny
jasny / gopenvpn.sh
Last active December 13, 2015 16:58
GTK interface to start openvpn
#!/bin/bash
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
jasny / HTMLToXMLFilter.php
Created June 26, 2014 10:41
Stream filter to convert HTML5 to XML
<?php
/**
* Stream filter to convert HTML5 to XML.
*
* <code>
* $dsn = "php://filter/read=htmltoxml/resource=" . $url;
* $xml = XMLReader::open($dsn);
* </code>
*