Skip to content

Instantly share code, notes, and snippets.

View boywhoroared's full-sized avatar

Boy Who Roared boywhoroared

View GitHub Profile
@boywhoroared
boywhoroared / Makefile
Last active August 29, 2015 14:18 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
#!/bin/bash
#
# Requires ftxdumperfuser from http://developer.apple.com/textfonts/download/
#
# Usage: fixconsolas [files ...]
# When called with no arguments, it attempts to operate on every TrueType
# file in the current directory.
#
# References:
# http://bandes-storch.net/blog/2008/12/21/consolas-controlled/#comment-2042
<?php
// add this to your php.ini
// auto_prepend_file = /path/to/virtual.prepend.php
$http_host = explode('.',$_SERVER['HTTP_HOST']);
$__mod_vhost_alias_fix_doc_root = $_SERVER['DOCUMENT_ROOT'] .
DIRECTORY_SEPARATOR . $http_host[0] .
DIRECTORY_SEPARATOR . 'public';
if (is_dir($__mod_vhost_alias_fix_doc_root)) {
server {
index index.php;
set $basepath "/var/www";
set $domain $host;
# check one name domain for simple application
if ($domain ~ "^(.[^.]*)\.dev$") {
set $domain $1;
set $rootpath "${domain}";
@boywhoroared
boywhoroared / init-env-wifi.sh
Last active August 29, 2015 13:57
Setup your OS X environment based on your "location" by checking the WiFi network you're connected to.
#!/bin/sh
# the name of your Wireless interface. Might be en1 on some machines.
AIRPORT="en0"
# name of the wifi network
WIFI_WORK="<name-of-your-office-wifi>";
if networksetup -getairportnetwork $AIRPORT | grep -i -a $WIFI_WORK ;
then
@boywhoroared
boywhoroared / mysql-duplicates.sql
Created May 15, 2013 19:20
Find duplicated values for a given field.
SELECT `field` FROM `table` GROUP BY `field` HAVING count(field) > 1;
-- Find duplicated values for the column `field`
@boywhoroared
boywhoroared / mysql-dump-restore.sql
Created June 29, 2011 13:47
MySQL Dump & Restore Charset Safe
mysqldump -u username -p --default-character-set=latin1 -N database > backup.sql
mysql -u username -p --default-character-set=latin1 database < backup.sql
@boywhoroared
boywhoroared / copy-tables.cmd
Created June 15, 2011 18:29
MYSQL: Copy tables from one schema to another (uses mysql client)
mysqldump -u(username) -p(password) (source database name) (table names...) | mysql -u(username) -p(password) (destination database name)
@boywhoroared
boywhoroared / CopyTable.sql
Created June 15, 2011 18:27
MYSQL: Copy a table from one schema to another.
USE db2;
CREATE TABLE table2 LIKE db1.table1;
INSERT INTO table2
SELECT * FROM db1.table1;