Skip to content

Instantly share code, notes, and snippets.

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

Mario Vejlupek elmariofredo

💭
building Cloud Native Thermostat 🔥 🥶
View GitHub Profile
@elmariofredo
elmariofredo / bump.sh
Last active August 29, 2015 14:04
npm publishing script
#!/bin/bash
npm version $1 -m "$2"
git push --tags
npm publish
@elmariofredo
elmariofredo / 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"
@elmariofredo
elmariofredo / 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'
@elmariofredo
elmariofredo / 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
@elmariofredo
elmariofredo / 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)

# did not return nil exception
to_s >> to_splat. nil.to_splat
# Multiple splats allowed
def foo(*a)
a
end
foo(1, *[2,3], 4, *[5,6]) # => [1, 2, 3, 4, 5, 6]
a = [1,2,3]
http://paulbarry.com/articles/2010/01/13/customizing-generators-in-rails-3
http://github.com/mbleigh/haml-rails
http://github.com/thoughtbot/factory_girl
http://paulbarry.com/articles/2010/01/13/customizing-generators-in-rails-3
#
# wb_utils.grt.py
# MySQLWorkbench
#
# Created by Kuru on 25/Mar/10.
# Copyright (c) 2010 KuruLab. There are many rights to fuckup... Ricky TPB.
#
# This Pyhon script simply export your MySQLWorkBench project to rails scaffold commandline
# This is just concept of final plugin which i hope will be in old good pure ruby... depends on oracle now ;-)
#
# This template installs the new jQuery drivers, removes
# the old prototype drivers, and installs an initializer
# which overrides the javascript_include_tag to include
# jQuery and the new drivers with :default
# Written by: Logan Leger, logan@loganleger.com
# http://github.com/lleger/Rails-3-jQuery
# Downloading latest jQuery.min
exec "curl -L http://code.jquery.com/jquery-latest.min.js > public/javascripts/jquery.js"