Skip to content

Instantly share code, notes, and snippets.

View navasvarela's full-sized avatar

Juan M Salamanca navasvarela

  • Southampton, Hampshire, UK
View GitHub Profile
@navasvarela
navasvarela / .bashrc
Created December 18, 2013 18:05
My .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@navasvarela
navasvarela / .vimrc
Created March 6, 2013 17:11
My .vimrc with PrettyXML
call pathogen#infect()
filetype plugin indent on
syntax on
set tabstop=4
set shiftwidth=4
set showmatch
set number
map <F3> <Esc>gg=G<CR>
imap <F3> <Esc>gg=G<CR>
@navasvarela
navasvarela / post-update
Created September 6, 2012 09:31
Deploy using git
#!/bin/sh
# Post update hook to be added to the dir.git repository
# This hook pulls the master from the repo into the working web app git repo
echo
echo "Pulling changes into deployment repository"
echo
git --git-dir /path/to/webapp/dir/.git --work-tree /path/to/webapp/dir/ pull origin master
@navasvarela
navasvarela / .htaccess
Created September 6, 2012 09:05
Sinatra setup in bluehost
AddHandler fcgid-script .fcgi
AddHandler cgi-script .cgi
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
grep generated 802-1x.log |awk '{print $11}'|while read line; do echo -n "$line, " ;o=`grep $line 802-1x.log|grep "END OUTBOUND"|awk '{print $11}'`;echo -n "$o, ";i=`grep $line 802-1x.log|grep "END INBOUND"|awk '{print $11}'`;echo $i;done
@navasvarela
navasvarela / extract_times.sh
Created August 30, 2012 15:21
parse log file and get times
#!/bin/bash
LOGFILE=logs/802-1x.log
BEGIN_LOG="START OUTBOUND"
END_LOG="END OUTBOUND"
rm -f begins.log
rm -f ends.log
rm -f unparseable.log
rm -f radius_times.csv
@navasvarela
navasvarela / gist:1158322
Created August 19, 2011 23:43
My .vimrc
filetype plugin on
syntax on
set tabstop=4
set shiftwidth=4
set showmatch
set number
map <F3> <Esc>gg=G<CR>
imap <F3> <Esc>gg=G<CR>
map <F5> :w<CR>:!node %:p<CR>
@navasvarela
navasvarela / gist:1151482
Created August 17, 2011 12:57
Shell script to classify pictures according to month taken
#!/bin/bash
FILES=`find . -iregex '.*JPG'`
for file in $FILES
do
lastmod=`exiftool $file | grep 'Create Date' | awk '{print $4}' | sed 's/:/-/g'| sort | uniq`
echo "$file, Last Modification Date: $lastmod-"
month=`date --date="$lastmod" "+%B%Y"`
if [ ! -d $month ];then
mkdir $month