Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View lovato's full-sized avatar

Marco Lovato lovato

  • Vancouver WA, USA
View GitHub Profile
#!/bin/bash
set -e
set -x
# Root Access
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@lovato
lovato / auto-virtualenv.sh
Created April 1, 2014 12:33
Script to help switching automatically from a virtualenv to another
# --- activate a virtualenv without the need of going through a series of
# paths
function venv { source $WORKON_HOME/$1/bin/activate; }
# --- create a virtualenv
function mkenv { virtualenv $WORKON_HOME/$1; venv $1; echo "$1" > ./.venv; }
# --- automagically load virtualenvs, based on the ".venv" file in the directory
# -- search for the ".venv" from the current directory and, if it can't be found,
@lovato
lovato / .gitconfig
Last active August 29, 2015 13:57 — forked from jbonney/.gitconfig
[user]
email = <your email>
name = <your name>
[gitreview]
username = <your username>
[alias]
newf = !bash -c 'git checkout -b feature/$0'
uploadf = !bash -c 'git push origin `git rev-parse --abbrev-ref HEAD`'
updatef = !bash -c 'git fetch && git merge master --no-ff'
gof = !bash -c 'git checkout feature/$0'
@lovato
lovato / video4roku
Last active December 29, 2015 06:19
Script used to convert any video to a AVC AAC Roku compatible format.
echo Video4Roku Converter 1.0 by @maglovato
echo --------------------------------------
filename=$(basename "$1")
extension="${filename##*.}"
filename="${filename%.*}"
#avconv -i "$1" -c:v libx264 -c:a libvo_aacenc "/tmp/$filename.mp4"
avconv -i "$1" -c:v libx264 -c:a aac -strict experimental "/tmp/$filename.mp4"
@lovato
lovato / java-reinstall.sh
Last active February 23, 2021 01:11
Wipe out Java from Ubuntu, and then fresh install it back.
#
#http://askubuntu.com/questions/84483/how-to-completely-uninstall-java
#
java_version=`java -version 2>&1 | head -n 1 | awk -F"\"" '{print $2}'`
#Remove all the Java related packages (Sun, Oracle, OpenJDK, IcedTea plugins, GIJ):
sudo apt-get update
apt-cache search java | awk '{print($1)}' | grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' -e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' -e 'java-common' | xargs sudo apt-get -y remove
sudo apt-get -y autoremove