Skip to content

Instantly share code, notes, and snippets.

@ahmadsoe
ahmadsoe / spotify.js
Created September 23, 2014 09:37
spotify starred
// npm install 1994rstefan/node-spotify-web
var Spotify = require('spotify-web');
// Spotify credentials...
var username = process.argv[2];
var password = process.argv[3];
// console.log("username:"+username);
// console.log("pass:" + password);
#! /bin/bash
# Acknowledgements
# I forked this code from Chris Fidao see: https://gist.github.com/fideloper
# May need to run this as sudo!
# I have it in /usr/local/bin and run command 'vhost' from anywhere, using sudo.
NORMAL=$(tput sgr0)
GREEN=$(tput setaf 2; tput bold)
@ahmadsoe
ahmadsoe / mysql_bzip2
Last active August 29, 2015 14:04
mysql export import with bzip2
### mysql export with bzip2
mysqldump -u root --routines --triggers db_name | bzip2 > dump.sql.bz2
### mysql import with bzip2
bunzip2 < dump.sql.bz2 | mysql -u root db_name
@ahmadsoe
ahmadsoe / haproxy_restart.sh
Created May 29, 2014 00:25
Restart haproxy
#!/bin/bash
echo "Gracefully reloading haproxy..."
sudo haproxy -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)
echo "[done]"
@ahmadsoe
ahmadsoe / docker-remove.sh
Created May 25, 2014 21:24
Stop & remove all docker containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
@ahmadsoe
ahmadsoe / upgrade_kernel_ubuntu.sh
Created May 8, 2014 12:47
ubuntu kernel update
apt-get -y install linux-image-generic-lts-raring linux-headers-generic-lts-raring
reboot
@ahmadsoe
ahmadsoe / hardenUbuntu.sh
Last active April 11, 2020 20:00 — forked from lrobert/hardenUbuntu.sh
Ubuntu Installation script
#!/bin/bash
#
# Lee Robert's Base Ubuntu Installation script for use on Digital Ocean (Or any other ubuntu install really.)
# Made and tested with Ubuntu 13.04 64bit
#
# USAGE: bash hardenUbuntu.sh
#
# Steps:
# 01. Secure Root User
# 02. Make .bashrc print out pretty colors (and root's prompt will be red)
@ahmadsoe
ahmadsoe / posgresql-tuning
Created May 6, 2014 10:30
Posgresql 9.3 Tuning
## Posgresql 9.3 Tuning
# RAM = 8GB
# http://pgtune.leopard.in.ua/
max_connections = 200
shared_buffers = 2GB
effective_cache_size = 6GB
work_mem = 10485kB
maintenance_work_mem = 512MB
checkpoint_segments = 32
@ahmadsoe
ahmadsoe / ubuntu-posgresql-redis.sh
Created May 6, 2014 08:50
Install postgresql 9.3, latest redis on ubuntu 12.04
#!/bin/sh
# Update System
echo "System Update"
sudo apt-get -y update
echo "Update completed"
# Dependency Package Install
sudo apt-get -y install libssl-dev build-essential pkg-config git
sudo apt-get -y install python-software-properties python
@ahmadsoe
ahmadsoe / setup-postgresql-ubuntu.sh
Created May 6, 2014 06:38
Setup postgresql 9.3 on ubuntu 12.04
#!/bin/bash
#
REPO_FILE=/etc/apt/sources.list.d/pgdg.list
UBUNTU_VERSION=$(lsb_release -sr)
if [[ $UBUNTU_VERSION -eq '12.04' ]]; then
echo ' * Using defaults for 12.04 (Precise)'
UBUNTU_VERSION='precise'
elif [[ $UBUNTU_VERSION -eq '10.04' ]]; then