Skip to content

Instantly share code, notes, and snippets.

View dmp1ce's full-sized avatar
😃
Enjoying life

David dmp1ce

😃
Enjoying life
View GitHub Profile
@dmp1ce
dmp1ce / gist:1508535
Created December 22, 2011 01:45 — forked from sontek/snowjob.sh
Make your terminal snow
#!/bin/bash
LINES=$(tput lines)
COLUMNS=$(tput cols)
declare -A snowflakes
declare -A lastflakes
clear
diff --git a/simpletest_clone_test_case.php b/simpletest_clone_test_case.php
index 640353a..cb88f9b 100644
--- a/simpletest_clone_test_case.php
+++ b/simpletest_clone_test_case.php
@@ -118,6 +118,7 @@ class SimpleTestCloneTestCase extends DrupalWebTestCase {
variable_set('mail_system', array('default-system' => 'TestingMailSystem'));
drupal_set_time_limit($this->timeLimit);
+ $this->setup = TRUE;
}
@dmp1ce
dmp1ce / drupalCreateUserWithRole.php
Created September 8, 2012 17:03
Creates a user with a given role using the Drupal simpletest framework.
/**
* Creates a user with the give role.
**/
public function drupalCreateUserWithRole($role) {
// Get all of the roles in the system.
$roles = user_roles();
// Find the index for the role we want to assign to the user.
$index = array_search($role, $roles);
@dmp1ce
dmp1ce / duplicity_backup.sh
Created September 15, 2012 01:44
Duplicity backup script
#!/bin/bash
# Backup all important files on my computer using Duplicity
# Folders to include
include_directories=(/home/me /etc)
# Folders to exclude
exclude_directories=()
@dmp1ce
dmp1ce / prepare-linode-gentoo-image.sh
Created September 27, 2012 18:50
Linode gentoo setup script
#!/bin/bash
# Some things to do for a fresh Linode Gentoo install
# Source: http://www.linode.com/wiki/index.php/Gentoo
# TODO: This should be run as ROOT!
# Get portage in sync
eix-sync
@dmp1ce
dmp1ce / bootstrap.inc.php
Last active December 13, 2015 18:18
Drupal 6 code which is responsible for asking for Bad Request pages.
<?php
/**
* Validate that a hostname (for example $_SERVER['HTTP_HOST']) is safe.
*
* As $_SERVER['HTTP_HOST'] is user input, ensure it only contains characters
* allowed in hostnames. See RFC 952 (and RFC 2181). $_SERVER['HTTP_HOST'] is
* lowercased.
*
* @return

Keybase proof

I hereby claim:

  • I am dmp1ce on github.
  • I am daveparrish (https://keybase.io/daveparrish) on keybase.
  • I have a public key whose fingerprint is 36DC 0151 AF97 F614 56D1 D744 05D4 30C2 AD9F DBC0

To claim this, I am signing this object:

Verifying that +daveparrish is my Bitcoin username. You can send me #bitcoin here: https://onename.io/daveparrish
@dmp1ce
dmp1ce / start_transmission_daemon.sh
Created May 3, 2015 12:18
Start transmission-daemon and bind it to VPN IP address
#!/bin/bash
# Kill transmission-daemon if it is running
transmission_da_pid=$(pgrep transmission-da)
if [ $transmission_da_pid ]; then
killall transmission-daemon && echo "Closing existing tranmission-daemon processes ..." && sleep 8
fi
# Get VPN IP to bind to
bind_address=$(ip addr show tun0 | grep inet | awk '{print $2}')
$ (git clone https://github.com/dmp1ce/decompose) 2>&1 >/dev/null
Cloning into 'decompose'...
remote: Counting objects: 190, done.
remote: Total 190 (delta 0), reused 0 (delta 0), pack-reused 190
Receiving objects: 100% (190/190), 31.33 KiB | 0 bytes/s, done.
Resolving deltas: 100% (96/96), done.
Checking connectivity... done.