Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View macmladen's full-sized avatar

Mladen Đurić macmladen

View GitHub Profile
@macmladen
macmladen / dps.sh
Created November 23, 2015 23:07
Build local environment for development
## Always, before performing any installation, make sure that system is up to date:
# Freshen information on versions of system software packages
sudo apt-get update
# Perform upgrade of packages
sudo apt-get upgrade
# Perform upgrade of system (kernel)
sudo apt-get dist-upgrade
## Getting to know system
@macmladen
macmladen / logging_in.md
Last active September 13, 2016 07:35
Linux and Mac interactive shell script loading

Order of script loading for interactive login shell

User can have multiple ways to login and different OSes, different shells have different approach. As I always search for same information, I decided to collect them here.

To understand what's going on here, you need to understand a little background information about how shells (bash in this case) are run.

  • When you open a terminal emulator (gnome-terminal for example), you are executing what is known as an interactive, non-login shell.
  • When you log into your machine from the command line, via ssh, or run a command such as su username, you are running an interactive login shell.
[user]
name = MacMladen iMac
email = mladen@bluefish.rs
[color]
ui = on
[core]
excludesfile = /Users/mladen/.gitignore_global
whitespace= fix,-indent-with-non-tab,-indent-with-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore_global
[difftool "sourcetree"]
@macmladen
macmladen / .barracuda.cnf
Last active December 27, 2015 20:04
BOA full procedure for server upgrade
###
### Configuration created on 151219-0247
###
_LOCAL_NETWORK_HN=""
_LOCAL_NETWORK_IP=""
_MY_FRONT="aegir.dx.rs"
_MY_HOSTN="dx.rs"
_MY_OWNIP="5.9.90.162"
_SMTP_RELAY_HOST=""
_SMTP_RELAY_TEST=YES
@macmladen
macmladen / phjs-screencapture.js
Created September 18, 2015 12:30
Script to capture screen using phantomjs.org headless
// Copyright: (C) 2015 MacMladen <macmladen@gmail.com>
// License: GPL-2.0
// Prequisite:
// having installed phantomjs from http://phantomjs.org
// You have to change variables to suit your needs
// Usage:
// $ phantomsj script.js
// it will produce capture file in same folder
// you can figure out the rest ;)
var
@macmladen
macmladen / drush-si.sh
Created August 30, 2015 10:37
drush site-install template
dr si standard \
--account-mail=lucar_loc@bluefish.rs \
--account-name=admin \
--account-pass=plavac \
\
# --db-su=lokalni \
# --db-su-pw=lokalni \
--db-url=mysql://lokalni:lokalni@localhost/lucar \
# --locale=<en-GB> \
\
@macmladen
macmladen / .gitconfig
Last active September 11, 2018 08:47
Git hints, .gitconfig and .gitignore files - should be moved to 'dotfiles' repo
[user]
name = MacMladen iMac
email = mladen@bluefish.rs
[color]
ui = on
[core]
excludesfile = /Users/mladen/.gitignore_global
whitespace= fix,-indent-with-non-tab,-indent-with-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore_global
[difftool "sourcetree"]
@macmladen
macmladen / bash_functions.sh
Created April 3, 2015 08:26
Some useful bash functions to be included (sourced) in your bash scripts
# promptyn "{message}" {default_answer}
# $1 "{message}" like "Do you wish to procede? [Yn]"
# $2 {default_answer} you can pass default value, just notify that in message above
# @return
# 0 for any of y, Y, yes, YAYA, yabbadabbadoo
# 1 for any of n, N, Nein, nikako, nonononoooo
promptyn() {
while true; do
read -p "$1 " yn
CHOICE=${yn:0:1}
@macmladen
macmladen / git-merged-remove.sh
Last active January 13, 2016 13:27
Remove merged remote branches in repository.
#!/bin/sh
# Taken from and modified
# http://devblog.springest.com/a-script-to-remove-old-git-branches/
echo "The following remote branches are fully merged into master and will be removed:"
git branch -r --merged master | sed 's/ *origin\///' | grep -v 'master$'
read -p "Continue (y/n)?"
if [ "$REPLY" == "y" ] ; then # Remove remote fully merged branches
git branch -r --merged master | sed 's/ *origin\///' | grep -v 'master$' | xargs -I % git push origin --delete %
@macmladen
macmladen / .exclude.rsync.sh
Last active August 29, 2015 14:16
.exclude.rsync used to hold exclude for rsyncing Drupal site local <-> live, used shell syntax for highlighting
# Rsync EXCLUDE configuration to user@server.com:public_html
# test drive, remove n to actually sync
# I - ignore time, c - checksum, grep to exclude unchanged files
# rsync -aniIc --exclude-from=.exclude.rsync ./ user@server.com:public_html/ | grep -v "^\."
# Not needed on live:
.git*
sites/all/drush
.exclude.rsync