Skip to content

Instantly share code, notes, and snippets.

View lmduc's full-sized avatar

Duc Le lmduc

View GitHub Profile
#
# Default settings for /etc/init.d/sysstat, /etc/cron.d/sysstat
# and /etc/cron.daily/sysstat files
#
# Should sadc collect system activity informations? Valid values
# are "true" and "false". Please do not put other values, they
# will be overwritten by debconf!
ENABLED="true"
@lmduc
lmduc / sysstat
Created September 19, 2016 09:21
sysstat file
# The first element of the path is a directory where the debian-sa1
# script is located
PATH=/usr/lib/sysstat:/usr/sbin:/usr/sbin:/usr/bin:/sbin:/bin
# Activity reports every 2 minutes everyday
*/2 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
# Additional run at 23:59 to rotate the statistics file
59 23 * * * root command -v debian-sa1 > /dev/null && debian-sa1 60 2
@lmduc
lmduc / install_rbenv.sh
Created June 27, 2016 08:39
Install rbenv
#!/usr/bin/env bash
# Verify Git is installed:
if [ ! $(which git) ]; then
echo "Git is not installed, can't continue."
exit 1
fi
if [ -z "${RBENV_ROOT}" ]; then
RBENV_ROOT="$HOME/.rbenv"
#!/bin/sh
echo "sudo apt-get update\n"
sudo apt-get update
echo "curl -sSL https://get.docker.com/ | sh\n"
curl -sSL https://get.docker.com/ | sh
sudo usermod -aG docker $(whoami)
echo "sudo service docker stop\n"
echo "==================UPDATE\n"
sudo apt-get update
echo "==================INSTALL DOCKER\n"
curl -sSL https://get.docker.com/ | sh
sudo usermod -aG docker $(whoami)
echo "==================INSTALL LIBS\n"
sudo apt-get install -y python-pip python-dev build-essential
echo "==================INSTALL PIP\n"
#!/bin/bash
trap 'excode=$?; cleanup; echo $excode; exit' EXIT HUP INT QUIT PIPE TERM
cleanup() {
# TODO: kill web
echo "inside cleanup for $1"
deregister_service
}
@lmduc
lmduc / temp_deregister.txt
Created June 3, 2016 07:22
temp_deregister
#!/bin/bash
deregister_service() {
export CONTAINER_ID=$(cat /proc/self/cgroup | grep "pids:/" | sed 's/\([0-9]\):pids:\/docker\///g')
echo "\nDeregistering $CONTAINER_ID with consul server $CONSUL_SERVER\n"
curl -XPUT "$CONSUL_SERVER/v1/agent/service/deregister/$CONTAINER_ID"
}
main() {
deregister_service
@lmduc
lmduc / autoserver.txt
Last active June 28, 2016 07:07
Setup Sinatra server running on Thin using the default Ruby 1.9.3
echo 'INSTALL NEEDED LIBS FOR THE OS'
sudo apt-get update
sudo apt-get install -y git make g++ git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev ruby-dev libpq-dev yui-compressor
echo 'INSTALL nodejs'
(curl -sL https://deb.nodesource.com/setup_6.x | sudo sh) && sudo apt-get install -y nodejs
echo 'INSTALL rbenv'
cd && git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
@lmduc
lmduc / .tmux.conf
Last active March 2, 2016 07:58
brew install tmux
set -g default-terminal "screen-256color"
# Scroll History
set -g history-limit 30000
set -g prefix C-a
unbind C-b
bind a copy-mode
bind r source-file ~/.tmux.conf
@lmduc
lmduc / .vimrc
Last active January 9, 2017 02:04
set nocompatible
filetype off
let mapleader=" "
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'