Skip to content

Instantly share code, notes, and snippets.

View cpliakas's full-sized avatar

Chris Pliakas cpliakas

  • Greater Boston Area
View GitHub Profile
@cpliakas
cpliakas / gorilla-mux-json
Created November 1, 2014 21:08
Gorilla Mux return JSON payload
package main
import (
"log"
"net/http"
"github.com/bitly/go-simplejson"
"github.com/gorilla/mux"
)
@cpliakas
cpliakas / ubuntu-x11
Created May 4, 2012 16:07
Headless X server on Ubuntu for X11 forwarding
#!/bin/bash
sudo apt-get install xserver-xorg xserver-xorg-core x11-apps x11-xserver-utils
@cpliakas
cpliakas / ant-composer.xml
Created November 26, 2013 01:20
Apache Ant tagets for Composer commands.
<?xml version="1.0" encoding="UTF-8"?>
<project name="Composer Targets" default="build">
<property name="builddir" value="${basedir}/build"/>
<property name="composer" value="${builddir}/composer.phar"/>
<target name="php-check">
<condition property="php" value="php">
<not>
<isset property="${php}"/>
@cpliakas
cpliakas / Mysqltop
Created February 9, 2012 03:27
Mysql top
#!/bin/bash
watch -n 5 --differences mysqladmin processlist
@cpliakas
cpliakas / goriall-mux-github-auth
Created October 30, 2014 18:01
Gorilla Mux w/ GitHub authentication
package main
import (
"flag"
"log"
"net/http"
"os"
"github.com/gorilla/mux"
"github.com/stretchr/gomniauth"
@cpliakas
cpliakas / git-ssh-wrapper
Created January 9, 2013 22:47
An SSH wrapper written in PHP useful when set as the GIT_SSH variable.
#!/usr/bin/env php
<?php
require_once __DIR__ . '/../vendor/autoload.php';
try {
// Get the arguments passed through the command line.
$args = (!empty($_SERVER['argv'])) ? $_SERVER['argv'] : array();
if (!isset($args[0])) {
$args[0] = $_SERVER['PHP_SELF'];
@cpliakas
cpliakas / vagrant-ubuntu-1204
Created October 11, 2012 00:44
Vagrant base box script for Ubuntu 12.04
#!/bin/sh
# curl -L https://bit.ly/vagrant-setup-ubuntu > vagrant-setup.sh
# sudo sh vagrant-setup.sh
set -e
# Add the vagrant user as a password-less sudoer.
TMPFILE=$(mktemp)
echo "vagrant ALL=(ALL) NOPASSWD: ALL" > $TMPFILE
@cpliakas
cpliakas / clear-cache-drupal
Created August 2, 2012 16:05
Find and clear all cache tables
mysql -B -N dbname -e "SHOW TABLES LIKE 'cache%'" | xargs -I {} mysql dbname -e "TRUNCATE {}"
@cpliakas
cpliakas / Screenshot file
Created January 25, 2012 20:24
Taking screenshots from a list of files
#!/bin/bash
if [ -z "$1" ]; then
echo "Filename required."
exit 1
fi
while read LINE; do
URL=$(echo "$LINE" | awk '{print $1'})
FILENAME=$(echo "$LINE" | awk '{print $2'})
@cpliakas
cpliakas / screenshots
Created January 24, 2012 16:55
Browser screenshots from the command line on Ubuntu
#!/bin/bash
xvfb-run --server-args="-screen 0, 1024x768x24" wkhtmltopdf -q -B 0 -T 0 -L 0 -R 0 http://google.com google.com.pdf
convert -density 300 google.com.pdf -append google.com.jpg