Skip to content

Instantly share code, notes, and snippets.

@shoaibali
shoaibali / setup-silverstripe-development.sh
Last active May 3, 2017 23:31
Sets up ntp, DNSMasq, Git, SilverStripe, MySQL, phpMyAdmin, ATOM, SublimeText, HipChat, Google Chrome, Meld, NPM, NodeJS, yarn, Tools and other system tweaks
#!/bin/bash
echo "---- INSTALLING SYSTEM TOOLS ---"
sudo apt-get update
sudo apt-get install build-essential htop figlet dos2unix dnsmasq curl wget nodejs npm memcached debconf-utils mailutils sendmail sshfs graphviz ntp -y
sudo sh -c 'echo "deb https://atlassian.artifactoryonline.com/atlassian/hipchat-apt-client $(lsb_release -c -s) main" > /etc/apt/sources.list.d/atlassian-hipchat4.list'
wget -O - https://atlassian.artifactoryonline.com/atlassian/api/gpg/key/public | sudo apt-key add -
sudo add-apt-repository ppa:webupd8team/sublime-text-3 -y
<VirtualHost *:80>
ServerName silverstripe.dev
ServerAdmin webmaster@localhost
DocumentRoot /var/www/silverstripe
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
@shoaibali
shoaibali / .bashrc
Last active March 21, 2016 09:58
show color of git branch
# Avoid duplicates
export HISTCONTROL=ignoredups:erasedups
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000 # big big history
# When the shell exits, append to the history file instead of overwriting it
shopt -s histappend
# After each command, append to the history file and reread it
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
@shoaibali
shoaibali / _ss_environment.php
Created February 10, 2016 22:58
environment file used for travis-ci
<?php
define('SS_ENVIRONMENT_TYPE', 'dev');
// trust test environment
define('SS_TRUSTED_PROXY_IPS', '*');
// Database connection, including PDO and legacy ORM support
$db = getenv('DB');
$release = getenv('CORE_RELEASE');
$pdo = getenv('PDO');
{
"bitwise": true,
"curly": true,
"eqeqeq": true,
"forin": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
@shoaibali
shoaibali / droptables.sh
Created November 25, 2015 11:39
MySQL drop tables shell script - added host support
#!/bin/bash
MUSER="$1"
MPASS="$2"
MDB="$3"
MHOST="$4"
# Detect paths
MYSQL=$(which mysql)
AWK=$(which awk)
GREP=$(which grep)
@shoaibali
shoaibali / gist:e6afb7267af7a4a32260
Created November 24, 2015 07:08
running command as www-data on daas
sudo su www-data -s /bin/bash
@shoaibali
shoaibali / _config.php
Last active August 4, 2016 03:24
SilverStripe memcached multiple servers
<?php
// Other useful changes and commands
// watch "echo stats | nc 127.0.0.1 11211"
// session.save_handler = memcache
// session.save_path = "tcp://server1:11211,tcp://server2:11211"
// $cache = SS_Cache::factory('foo');
// $cache->clean(Zend_Cache::CLEANING_MODE_ALL);
if (defined('MEMCACHE_SERVER_1') && defined('MEMCACHE_PORT_1')) {
$servers = array(
@shoaibali
shoaibali / gist:a019eb1ee9bc2a26e104
Created October 24, 2015 00:24
curl command to test docvert python3 posting a file and form variables using cURL
curl --form "[email protected]" --form pipeline="sanitised open document" --form autopipeline="Break up over Heading 1.default" http://DOCVERT-SERVER:DOCVERT-PORT/web-service
@shoaibali
shoaibali / install-stf.sh
Last active September 26, 2021 07:11
STF install shell script for ubuntu trusty
sudo apt-get install android-tools-adb android-tools-fastboot
wget -O - https://skia.googlesource.com/skia/+archive/cd048d18e0b81338c1a04b9749a00444597df394/platform_tools/android/bin/linux.tar.gz | tar -zxvf - adb
sudo mv adb /usr/bin/adb
sudo chmod +x /usr/bin/adb
adb devices
sudo apt-get install libtool pkg-config build-essential autoconf automake
sudo apt-get install graphicsmagick graphicsmagick-dbg graphicsmagick-imagemagick-compat graphicsmagick-libmagick-dev-compat
wget http://download.zeromq.org/zeromq-4.1.3.tar.gz
tar -zxvf zeromq-4.1.3.tar.gz
cd zeromq-4.1.3/