Skip to content

Instantly share code, notes, and snippets.

View gustavopp93's full-sized avatar

Gustavo gustavopp93

View GitHub Profile
!/bin/bash
mdate=`date +%Y%m%d`
mkdir -p /root/db/${mdate} $
cd /var/lib/mysql/
for db in $(ls -d */); do
echo -n "Backuping "${db%%/}" ... "
mysqldump -u root ${db%%/} > /root/db/${mdate}/${db%%/}.sql
/*Directive filereader*/
angular.module('youAppName')
.directive('fileread', function ($parse) {
return {
restrict: 'A',
require: 'ngModel',
link: function(scope, element, attrs, ctrl) {
var model = $parse(attrs.ngModel);
var modelSetter = model.assign;
@gustavopp93
gustavopp93 / gist:a35a615960e8c47f4c6b
Last active February 14, 2017 09:18
virtualenvwrapper
# YOU MUST BE IN USER ROOT
#Install virtualenvwrapper
pip install virtualenvwrapper
#Setup virtualenvwrapper
sudo gedit .bashrc
#Copy at the end of the file
export WORKON_HOME=$HOME/.virtualenvs
MYSQL:
-sudo apt-get install mysql-serve
POSTGRESQL:
https://www.digitalocean.com/community/articles/how-to-install-and-use-phppgadmin-on-ubuntu-12-04
sudo apt-get install postgresql postgresql-client postgresql-contrib
POSTGRESQL python driver:
sudo apt-get install postgresql-plpython
@gustavopp93
gustavopp93 / gist:6117883
Created July 30, 2013 23:10
find an element in a javascript array
var arr = [ 1, 9, 3, 8, 6, 1, 5, 9, 4, 7, 3, 8, 6, 9, 1 ];
arr = jQuery.grep(arr, function(n, i){
return (n != 5 && i > 4);});
1, 9, 4, 7, 3, 8, 6, 9, 1