This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BRANCH="$1" | |
if [ $BRANCH == "refs/heads/master" ]; then | |
echo "Deploying changes to production environment." | |
GIT_WORK_TREE=/Users/gnrfan/code/git-tests/production-environment git checkout -f | |
elif [ $BRANCH == "refs/heads/staging" ]; then | |
echo "Deploying changes to staging environment." | |
GIT_WORK_TREE=/Users/gnrfan/code/git-tests/staging-environment git checkout -f | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/env/bin python | |
# -*- coding: utf8 -*- | |
import random | |
import requests | |
import goless | |
MIN = 10000 | |
MAX = 99999 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define("BASE_URL", 'http://localhost/index.php'); | |
if (array_key_exists('QUERY_STRING', $_SERVER) && strlen(trim($_SERVER['QUERY_STRING']))>0) { | |
$url = sprintf("%s?%s", BASE_URL, $_SERVER['QUERY_STRING']); | |
} else { | |
$url = BASE_URL; | |
} | |
header('Status: 301 Moved Permanently', false, 301); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf8 -*- | |
""" | |
According to Wikipedia [1], the Vigènere cipher is a method of | |
encrypting alphabetic text by using a series of different Caesar | |
ciphers based on the letters of a keyword. It is a simple form | |
of polyalphabetic substitution. | |
An eastern egg based on cryptography is something you could expect [2] | |
from JJ Abrahams for the upcoming "Starwars: The Force Awakens" movie. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Works in PHP 5.3 | |
header("Content-Type: application/json", true, 500); | |
$doc = array( | |
"status" => "error", | |
"message" => "El correo no se pudo enviar" | |
); | |
echo json_encode($doc, JSON_PRETTY_PRINT); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URL="https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash" | |
PROFILE="$HOME/.bash_profile" | |
echo "Downloading git-completion..." | |
if ! curl "$URL" --silent --output "$HOME/.git-completion.bash"; then | |
echo "ERROR: Couldn't download completion script. Make sure you have a working internet connection." && exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install PPA tool | |
echo "Installing software for working with PPA packages..." | |
sudo apt-get install -y python-software-properties software-properties-common | |
# Install Oracle Java 8 | |
sudo add-apt-repository ppa:webupd8team/java | |
sudo apt-get update | |
echo "Installing ORACLE Java8..." | |
sudo apt-get install -y oracle-java8-installer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = 10 | |
b = 20 | |
print a + b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def quicksort(array, debug=False): | |
if array: | |
left = quicksort([x for x in array[1:] if x < array[0]]) | |
right = quicksort([x for x in array[1:] if x >= array[0]]) | |
if debug: | |
print "left", left | |
print "right", right | |
print "array[:1]", array[:1] | |
return left + array[:1] + right | |
return [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uuid | |
import hashlib | |
import baseconv | |
ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
def base62uuid(): | |
converter = baseconv.BaseConverter(ALPHABET) | |
uuid4_as_hex = str(uuid.uuid4()).replace('-','') | |
uuid4_as_int = int(uuid4_as_hex, 16) |
NewerOlder