Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Git ref to checkout in the ./src directory
NO_FETCH=$2
REF=$1
# Don't use - or . in the project name!
PROJECT=`basename $DIR`
@matglas
matglas / kwscripts
Last active August 29, 2015 13:55
Go to a kw directory
#!/bin/bash
#
# Include this script in your .bashrc like this:
# . ~/scripts/kwscripts
ROOT="/home/vhosts/"
function kws() {
project=$1
vhosts=$ROOT
# Install dnsmasq
sudo apt-get install dnsmasq
# Add lines to a configuration file in /etc/dnsmasq.d
# Don't use .local as address. That won't work.
nano dnsservers
> server=8.8.8.8
> server=8.8.4.4
@matglas
matglas / webform_create.install
Last active December 23, 2015 10:28
Dynamicly add a webform.
<?php
/**
* Implements hook_install().
*/
function hook_install() {
// Create Contact form from data file
// Define your components.
@matglas
matglas / d-file-perms.sh
Created September 3, 2013 06:34
Reset Drupal code base file permissions.
#!/bin/bash
cd `drush dd`
sudo chown [user]:[group] -R .
sudo find . -type d -exec chmod u=rwx,g=rx,o= '{}' \;
sudo find . -type d -exec chmod u=rwx,g=rx,o= '{}' \;
cd sites
for d in ./*/files
@matglas
matglas / cleanup-builds.sh
Created September 3, 2013 06:18
Clean up old build in Kraftwagen.
#!/bin/bash
DIR=`pwd`
if [ -d "$DIR/builds" ]
then
CURRENT=`ls -1 builds | sort | tail -1`
read -p "Do you want to remove all the old builds except $CURRENT (y/n)" -n 1 -s REMOVE_OLD_BUILDS