Skip to content

Instantly share code, notes, and snippets.

View devopsmariocom's full-sized avatar
💭
building Cloud Native Thermostat 🔥 🥶

Mario Vejlupek devopsmariocom

💭
building Cloud Native Thermostat 🔥 🥶
View GitHub Profile
@devopsmariocom
devopsmariocom / importify.sh
Created October 7, 2015 12:22
Pass entry file as argument to add imports of all other files
#!/bin/bash
rootFile=$1
entryFile=${rootFile}-entryFile
dirName=$(dirname $rootFile)
mv $rootFile $entryFile
for n in ${dirName}/*.?s; do
@devopsmariocom
devopsmariocom / gwtree.sh
Last active September 11, 2015 17:02
Checkout workintree from git to parent directory see https://git-scm.com/docs/git-worktree
#!/bin/bash
CURRENT_WORKTREE_DIR=../worktrees/${PWD##*/}
BRANCH=$1
mkdir -p $CURRENT_WORKTREE_DIR
git worktree add -b $BRANCH $CURRENT_WORKTREE_DIR/$BRANCH origin/$BRANCH
@devopsmariocom
devopsmariocom / VagrantGuide.md
Last active August 29, 2015 14:17
Vagrant 101

Vagrant 101

What is Vagrant

Tool for creating and managing virtual machines for development purpose.

You can setup specific os with specific provision scripts to build consistent dev environment.

First you need to create Vagrant file where you specify VM options and how you want to provision(Chef/Puppet/BASH/Ansible/Salt/Docker)

@devopsmariocom
devopsmariocom / grebase
Created March 20, 2015 07:45
Simple script for git rebasing with force push
#!/bin/bash
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
if [ $CURRENT_BRANCH == "develop" ];then
echo "Not allowed for develop branch"
else
@devopsmariocom
devopsmariocom / cron.d-watchdog
Last active August 29, 2015 14:16
Check specified url and run specified command if url is not accesible
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
*/2 * * * * root /usr/local/bin/curl_watchdog.sh http://example.com8 'service name restart'
@devopsmariocom
devopsmariocom / video_convert.sh
Created August 23, 2014 16:46
Video convert BASH script from mp4 to webm and ogv
#!/bin/bash
command -v ffmpeg >/dev/null 2>&1 || {
echo -e "FFmpeg is missing, Run\n$ brew install ffmpeg --with-libvpx --with-libtheora\nto install it on you Mac" >&2;
exit 1;
}
ffmpeg -i "$1" -c:v libvpx -qscale:v 0 "${1%%.mp4}.webm"
ffmpeg -i "$1" -c:v libtheora -qscale:v 0 "${1%%.mp4}.ogv"
@devopsmariocom
devopsmariocom / bump.sh
Last active August 29, 2015 14:04
npm publishing script
#!/bin/bash
npm version $1 -m "$2"
git push --tags
npm publish
@devopsmariocom
devopsmariocom / apiary.apib
Created July 15, 2014 10:58
Example of failing API with static URI parameters
FORMAT: 1A
HOST: http://localhost
# example api
Is example api
# Group Users
Users related resources of the **Users API**
## Users Collection [/users]
@devopsmariocom
devopsmariocom / php-deploy.sh
Created July 2, 2014 19:18
Simple PHP deploy script using git, inspired by capistrano magic. Just run ./php-deploy.sh BRANCH-NAME and target apache to /srv/app/public folder.
#!/bin/bash
project_name=app
[email protected]:some/repo.git
target_branch=$1
if [ ! -d "/srv/$project_name/repo" ]
then
echo "Setting up repo for the firts time"
# Put this in /etc/logrotate.d/mongodb
# http://stackoverflow.com/questions/5004626/mongodb-log-file-growth
/var/log/mongo/*.log {
daily
rotate 30
compress
dateext
missingok
notifempty