Skip to content

Instantly share code, notes, and snippets.

@wicochandra
wicochandra / .vimrc
Created March 1, 2021 12:53
Various home settings in UNIX
syntax on
set number
set expandtab
set tabstop=2 shiftwidth=2
set smarttab
set autoindent
set ignorecase
set smartcase
set hlsearch
@wicochandra
wicochandra / .tmux.conf
Created September 11, 2018 09:22
Personal development settings
#C-a as prefix and free C-b
set -g prefix C-a
unbind C-b
# Send C-a to application by pressing it twice
bind C-a send-prefix
# Reload configuration file
unbind r
bind r source-file ~/.tmux.conf \; display "Configration file .tmux reloaded!"
#!/bin/bash
set -e
ROOT_DIR=versions/$(date +%Y%m%d_%H%M%S)
read -p "Enter tag name: " TAG
read -p "Enter Bitbucket Username: " USERNAME
read -sp "Enter Bitbucket Password: " PASSWORD
echo git clone https://${USERNAME}@GIT_URL $ROOT_DIR --depth 1
git clone https://${USERNAME}:${PASSWORD}@GIT_URL $ROOT_DIR --depth 1
@wicochandra
wicochandra / server-installation.sh
Last active May 24, 2018 04:35
Simple Install script used for EC2 Ubuntu 16.04
# Support for one-time run only, if somethin happend in middle of the process
# Use comment to skip the success commands
apt-get update
# Variables
LOCALE="en_US.UTF-8"
TZ="Asia/Singapore"
USER="ubuntu"
@wicochandra
wicochandra / backup_all_database.sh
Last active November 30, 2015 09:38
Backup database script
#! /bin/bash
DB_USER=username
DB_PASS=password
BACKUP_DIR=absolute_dirpath/ #don't forget the trailing slash
DIR_NAME=$(date +%Y%m%d_%H%M%S)
NUM_BACKUP=14
DATABASES=$(mysql -u${DB_USER} -p${DB_PASS} -e 'show databases;' 2>&1)
if [[ $DATABASES == *"ERROR"* ]]; then
@wicochandra
wicochandra / init-database
Created October 27, 2015 17:05
Bash script to create new database and user
#! /bin/bash
databaseName="$1"
rootUser="root"
rootPass="pass"
user=$databaseName
userPassword=$(date +%s | sha256sum | base64 | head -c 15 ; echo)
runMySql() {
echo $(/usr/bin/mysql -u$rootUser -p$rootPass -e "$1;" 2>&1)
@wicochandra
wicochandra / dynamic-laravel-project.conf
Created October 6, 2015 08:41
Nginx Dynamic Project configuration
server {
listen 80;
set $project_dir /home/wico/Projects;
server_name ~^(?<project>.+)\.lvh\.me$;
index index.php index.html index.htm;
root $project_dir/$project/public;
client_max_body_size 1G;
@wicochandra
wicochandra / Preferences.sublime-settings
Last active January 5, 2016 07:09
My sublime text 3 user settings
{
"always_prompt_for_file_reload": false,
"always_show_minimap_viewport": false,
"animation_enabled": true,
"atomic_save": true,
"auto_close_tags": true,
"auto_complete": true,
"auto_complete_commit_on_tab": false,
"auto_complete_delay": 50,
"auto_complete_selector": "source - comment, meta.tag - punctuation.definition.tag.begin",
@wicochandra
wicochandra / nginx-project.conf
Created June 9, 2015 07:37
My default server configuration for development.
server {
listen 80;
listen 8888;
server_name localhost;
index index.php index.html index.htm;
root /path/to/root;
autoindex on;
@wicochandra
wicochandra / project-changer.sh
Created March 26, 2015 04:35
Changed root directory in nginx configuration.
#! /bin/sh
CONFIG_FILE="/etc/nginx/sites-available/project"
DIR=$1
if [ $# -eq 0 ]
then
DIR='.'
fi