Skip to content

Instantly share code, notes, and snippets.

View zipizap's full-sized avatar

zipizap

View GitHub Profile
@zipizap
zipizap / resize_jpegs.sh
Last active December 28, 2015 01:59
Resize all JPEG files in current directory, to <GEOMETRY> size
#!/bin/bash
function shw_grey { echo -e '\033[1;30m'"$1"'\033[0m'; }
function shw_norm { echo "$1"; }
function shw_info { echo -e '\033[1;34m'"$1"'\033[0m'; }
function shw_warn { echo -e '\033[1;33m'"$1"'\033[0m'; }
function shw_err { echo -e '\033[1;31mERROR: '"$1"'\033[0m'; }
function shw_usage {
cat <<EOT
Resize all JPEG files in current directory, to <GEOMETRY> size
#download the script into the Dropbox folder
cd $HOME/Dropbox && wget "http://gist.github.com/raw/564419/35634bc7a13e22dd58b5b0db645c2620b5aedc20/bckpDir2home.sh"
#and run it whenever you want to make a new backup.
cd $HOME/Dropbox
bash bckpDir2home.sh
#Download the script OpenDns_setup_dhclient.conf.sh
wget "http://gist.github.com/raw/565137/0ac98870256cbdb53eb8c16ccb69008a95c20127/OpenDns_setup_dhclient.conf.sh"
#Run it once as root
sudo bash OpenDns_setup_dhclient.conf.sh
puts "\e[1;30msome color text\e[0m"
echo -e '\033[37m\033[44mprint your text - everything written from now on will have the previous colors, untill you turn them off\033[0m'
echo -e '\033[37m' #turn on foreground color: white
echo -e '\033[44m' #turn on background color: blue
echo 'print your text - everything written from now on will have the previous colors, untill you turn them off'
echo -e '\033[0m' #turn off foreground and background color, to defaults
#allow user "zipizap" to use "sudo" for all commands, without password
zipizap ALL=(ALL) NOPASSWD: ALL
#allow group "mygroup" to use "sudo /my/command/that/will/be/run/as/root" without password
%mygroup ALL = NOPASSWD: /my/command/that/will/be/run/as/root
$ sudo visudo
#add the following to the end of the file:
#allow user "zipizap" to use "sudo /usr/bin/aptitude" without asking for password
zipizap ALL = NOPASSWD: /usr/bin/aptitude
#save and close the edited file
function shw_grey { echo -e '\033[1;30m'"$1"'\033[0m'; }
function shw_norm { echo "$1"; }
function shw_info { echo -e '\033[1;34m'"$1"'\033[0m'; }
function shw_warn { echo -e '\033[1;33m'"$1"'\033[0m'; }
function shw_err { echo -e '\033[1;31mERROR: '"$1"'\033[0m'; }
shw_grey "Blablabla nothing interesting..."
shw_norm "I reclaim some attention, but still within normality"
shw_info "I'm an info message - I stand out"
shw_warn "We must fix our economic system"