Skip to content

Instantly share code, notes, and snippets.

View nery's full-sized avatar
🍎
stuff

Nery Orellana nery

🍎
stuff
View GitHub Profile
@nery
nery / .profile
Last active July 13, 2022 18:02
generic profile
#enables color in the terminal bash shell export
export CLICOLOR=1
#sets up the color scheme for list export
export LSCOLORS=gxfxcxdxbxegedabagacad
#sets up the prompt color (currently a green similar to linux terminal)
MAGENTA="\033[1;36m"
PURPLE="\033[1;35m"
GREEN="\033[01;32m"
ORANGE="\033[01;31m"
WHITE="\033[01;37m"
@nery
nery / whatsmykey.sh
Created August 28, 2014 14:16
show and copy ssh public key
#!/bin/bash
cd ~/.ssh
echo "This is your key"
cat id_rsa.pub
pbcopy < id_rsa.pub
@nery
nery / aws.sh
Last active August 29, 2015 14:03
bash script to switch AWS creditials
function awscreds {
## switches between sets of AWS credentials.
## usage: awscreds <environment>
## e.g. awscreds tl
## It is advisable to customize the shell prompt to reflect current credentials.
if ! [[ -n $1 ]]; then
echo "Input is required"
else
case $1 in
@nery
nery / postalregex.js
Created February 20, 2014 17:17
Canadian postal code validation
/*
Slightly strict regex check for validly formatted Canadian postal code
http://jsfiddle.net/7mBFf/
*/
var postal = new RegExp(/^\s*[a-ceghj-npr-tvxy]\d[a-ceghj-npr-tv-z](\s)?\d[a-ceghj-npr-tv-z]\d\s*$/i);
console.log(postal.test('m6k1s4')); // returns true
console.log(postal.test('M6K1S4')); // returns true
console.log(postal.test('90210')); // returns false
@nery
nery / jQueryGeoIp.js
Created January 25, 2013 18:14
A ajax call to get a postal code from a geo location
var getLocation = function() {
if (navigator.geolocation) {
//get current position and pass the results to getPostalCode
return navigator.geolocation.getCurrentPosition();
} else {
return false;
}
};