Skip to content

Instantly share code, notes, and snippets.

View ofus's full-sized avatar

Andrew L. Joseph ofus

View GitHub Profile
@ofus
ofus / generate_code39_barcode.php
Created September 13, 2011 15:35 — forked from BHSPitMonkey/generate_code39_barcode.php
A PHP function that generates a Code 39 type barcode in pure HTML/CSS
// Prints out a Code 39 barcode in HTML/CSS
// $string should be a Code 39-compliant string to encode.
// Any characters not in the array below will be discarded.
function print_code39_barcode($string) {
$code39 = array(
'0'=>'NnNwWnWnN', '1'=>'WnNwNnNnW',
'2'=>'NnWwNnNnW', '3'=>'WnWwNnNnN',
'4'=>'NnNwWnNnW', '5'=>'WnNwWnNnN',
'6'=>'NnWwWnNnN', '7'=>'NnNwNnWnW',
'8'=>'WnNwNnWnN', '9'=>'NnWwNnWnN',
@ofus
ofus / vhost-wildcard-subdomain.conf
Created March 30, 2012 15:19
Apache Virtual Hosts with wildcard subdomain matching
UseCanonicalName Off
<VirtualHost *:80>
ServerAdmin nobody@example.com
ServerAlias *.example.com
VirtualDocumentRoot /var/www/%1/public
DirectoryIndex index.php index.htm index.html
<Directory /var/www/*/public/>
AllowOverride All
</Directory>
@ofus
ofus / convert_to_innodb.sh
Created March 31, 2012 05:05
Convert MyISAM tables to InnoDB
mysql -p -e "show tables in $DATABASE_NAME;" | tail --lines=+2 | xargs -i echo "ALTER TABLE {} ENGINE=INNODB;" > /tmp/alter_table.$DATABASE_NAME.sql
mysql --database=$DATABASE_NAME -p < /tmp/alter_table.$DATABASE_NAME.sql
@ofus
ofus / annoying.js
Created August 8, 2012 14:17 — forked from Kilian/annoying.js
How to be an asshole
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*
@ofus
ofus / pylcd.py
Created January 15, 2013 03:23 — forked from tech2077/pylcd.py
'''
Copyright (C) 2012 Matthew Skolaut
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
@ofus
ofus / annoying.js
Created February 11, 2013 23:51 — forked from Kilian/annoying.js
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*
;-------------------------------------------------------------------------------
; APPLICATION.INI CheatSheet for your Zend Framework Application
;
; Collection of all available configuration options via Zend_Application
; and it's bootstrap resources.
;
; Should work with Zend Framework 1.11.11
;-------------------------------------------------------------------------------
; @author Florian Eibeck <florian@eibeck.de>
;
pear uninstall -n phpunit/PHPUnit
pear uninstall -n phpunit/DbUnit
pear uninstall -n phpunit/PHP_CodeCoverage
pear uninstall -n phpunit/File_Iterator
pear uninstall -n phpunit/Text_Template
pear uninstall -n phpunit/PHP_Timer
pear uninstall -n phpunit/PHPUnit_MockObject
pear uninstall -n phpunit/PHPUnit_Selenium
pear uninstall -n pear.symfony-project.com/YAML
pear uninstall -n phpunit/PHP_TokenStream
# Send SMS messages using Raspberry Pi.
# Using gammu and Huawei E220
# Prepare SD card with wheezy.
# Login / complete rasp-config / reboot / login
# Set vimrc to prevent annoying ADBC arrow keys
cp /etc/vim/vimrc ~/.vimrc
@ofus
ofus / gist:6028366
Last active December 19, 2015 22:38
<?php
$dbh = new PDO("mysql:host=localhost;dbname=muratore", "root", "");
$sql = "SELECT count(*) FROM medrithms WHERE username=:username AND contrasena=:contrasena";
$stmt = $dbh->prepare($sql);
$stmt->execute(Array(':username' => $_POST['username'], ':contrasena' => $_POST['contrasena']));
$authenticated = $stmt->fetch(PDO::FETCH_COLUMN);
if ($authenticated) {