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 / martini-example
Last active August 29, 2015 14:08
Martini snippet, read SSH key w/ command line args
package main
import (
"flag"
"io/ioutil"
"os/user"
"code.google.com/p/go.crypto/ssh"
"github.com/cpliakas/test/hmac"
"github.com/go-martini/martini"
@cpliakas
cpliakas / gorilla-mux-example
Last active August 29, 2015 14:08
Gorilla Mux
package main
import (
"log"
"net/http"
"github.com/gorilla/mux"
)
func main() {
@cpliakas
cpliakas / goamz-dynamodb
Created November 13, 2014 21:58
Using Goamz to put an item in DynamoDB
package main
import (
"fmt"
"github.com/crowdmob/goamz/aws"
"github.com/crowdmob/goamz/dynamodb"
)
const (
@cpliakas
cpliakas / drupal-workflow-alter-roles
Created December 2, 2014 05:42
Patch to Drupal Workflow module to alter roles
diff --git a/includes/Entity/WorkflowState.php b/includes/Entity/WorkflowState.php
index 3b01bc1..c064adb 100644
--- a/includes/Entity/WorkflowState.php
+++ b/includes/Entity/WorkflowState.php
@@ -363,6 +363,9 @@ class WorkflowState extends Entity {
$roles = array_merge(array(WORKFLOW_ROLE_AUTHOR_RID), $roles);
}
+ // Allow modules to add or remove roles based on their own business logic.
+ drupal_alter('workflow_user_roles', $roles, $user, $entity_type, $entity);
@cpliakas
cpliakas / simple-logger.go
Last active August 29, 2015 14:20
Stoopid simple leveled logger fo Go
package main
import (
"io"
"io/ioutil"
"log"
"os"
)
const (
@cpliakas
cpliakas / vbox-guest-additions.sh
Created January 4, 2012 15:56
Helper script to install VirtualBox Guest Additions on Ubuntu servers.
#!/bin/bash
apt-get install dkms build-essential linux-headers-`uname -r` linux-headers-generic xserver-xorg xserver-xorg-core
mount /dev/cdrom /mnt
bash /mnt/VBoxLinuxAdditions.run
unount /mnt
@cpliakas
cpliakas / Drupal email scrub command
Created January 11, 2012 19:00
Updating Drupal user email addresses for development environments
UPDATE users SET mail = CONCAT('test+', uid, '@example.com');
@cpliakas
cpliakas / Set Apache Solr to read only
Created January 12, 2012 16:06
Set's the Apache Solr Search Integration module's read only setting to TRUE
#!/bin/bash
drush vset --yes apachesolr_read_only 1
@cpliakas
cpliakas / Ubuntu Virtual Network Device
Created January 19, 2012 19:15
Adds a virtual network interface to Ubuntu's network config file
#!/bin/bash
cat <<EOF >> /etc/network/interfaces
# Virtual network interface
auto eth1
iface eth1 inet static
name Host-only adapter
address 192.168.56.15
netmask 255.255.255.0
@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