Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
cat /dev/urandom | hexdump | awk '{printf "%c", $1%74+48}'
@cravecode
cravecode / start-stop-example.sh
Created March 14, 2016 20:56 — forked from alobato/start-stop-example.sh
start-stop-example
#!/bin/sh
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh
set -e
# Must be a valid filename
NAME=foo
PIDFILE=/var/run/$NAME.pid
#This is the command to be run, give the full pathname
DAEMON=/usr/local/bin/bar
@cravecode
cravecode / selenium-hub-daemon
Last active March 15, 2016 02:56 — forked from bcap/start-stop-daemon-template
File for starting Seleniun Standalone Server Hub as a linux services using the start-stop-daemon.
#!/bin/bash
### BEGIN INIT INFO
# Provides: selenium-hub
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: The Selenium Standaline Server ran as a hub.
### END INIT INFO
@cravecode
cravecode / example.md
Last active June 21, 2016 18:51
Using jQuery with custom Drupal page callback that returns Drupal AJAX command.

JS:

// Add a custom
(function ($) {
  $(function () {
    /**
     * Add an extra function to the Drupal ajax object that is specific to our
     * custom Drupal menu callback for: "custom/ajax/%/%".
     */
    Drupal.ajax.prototype.customAjaxHandler = function (arg1, arg2) {
@cravecode
cravecode / uninstall-old-php.sh
Created August 11, 2016 14:58
Uninstalls all php related packages.
#!/bin/bash
sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
@cravecode
cravecode / install-php-5-6-fpm-and-drush.sh
Last active April 23, 2023 00:10
Install PHP 5.6 FPM on Ubuntu 14.04 and Drush via Composer
#!/bin/bash
# Install PHP 5.6 (FPM) on Ubuntu 14.04 LTS
sudo add-apt-repository ppa:ondrej/php -y
sudo add-apt-repository ppa:ondrej/php5-compat -y
sudo apt-get update
sudo apt-get install php5.6 php5.6-fpm php5.6-curl php5.6-gd -y
# Change PHP FPM from socket to tcp connection.
sudo sed -i "s/^listen = \/run\/php\/php5.6-fpm.sock/;listen = \/run\/php\/php5.6-fpm.sock\nlisten = 127.0.0.1:9000/g" /etc/php/5.6/fpm/pool.d/www.conf
sudo service php5.6-fpm restart