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
#!/bin/bash | |
pushd /tmp | |
echo "Downloading ngrok" | |
rm -f /tmp/ngrok.zip | |
curl --silent https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip -o /tmp/ngrok.zip | |
echo "Downloaded" | |
unzip /tmp/ngrok.zip | |
if echo "$PATH" | grep /usr/local/bin; then | |
echo -e "\n Enter pwd if prompted" |
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
#!/bin/bash | |
set -o errexit | |
set -o pipefail | |
shopt -s nullglob | |
INSTALL_PATH="$HOME/opt/Telegram" | |
TEMP_PATH="$HOME/.tmp" | |
sudo apt-get install exo-utils xz-utils |
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
#!/bin/sh | |
## backup each mysql db into a different file, rather than one big file | |
## as with --all-databases. This will make restores easier. | |
## To backup a single database simply add the db name as a parameter (or multiple dbs) | |
## Putting the script in /var/backups/mysql seems sensible... on a debian machine that is | |
## Create the user and directories | |
# mkdir -p /var/backups/mysql/databases | |
# useradd --home-dir /var/backups/mysql --gid backup --no-create-home mysql-backup | |
## Remember to make the script executable, and unreadable by others |
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
#!/bin/bash | |
# This script will migrate schema and data from a SQLite3 database to PostgreSQL. | |
# Schema translation based on http://stackoverflow.com/a/4581921/1303625. | |
# Some column types are not handled (e.g blobs). | |
# | |
# See also: | |
# - http://stackoverflow.com/questions/4581727/convert-sqlite-sql-dump-file-to-postgresql | |
# - https://gist.github.com/bittner/7368128 |
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 next_digit(value, base): | |
return value + str(sum(int(a)*b for a,b in zip(value, base))%11%10) | |
def make_valid(value, ap2, base): | |
return next_digit(next_digit(value, base), ap2+base) | |
def numbers_only(string): | |
return ''.join([s for s in string if s.isdigit()]) | |
def is_valid_cpf(cpf): |
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
# Create a new working directory and cd into it | |
~$ mkdir -p /path/n4update && cd /path/n4update | |
# Download all files you need | |
/path/n4update$ wget --no-check-certificates https://dl.google.com/dl/android/aosp/occam-lrx22c-factory-86c04af6.tgz | |
# Download openrecovery-twrp-2.8.3.2-mako.img from http://techerrata.com/browse/twrp2/mako to the same path | |
# Download CF-Auto-Root-mako-occam-nexus4.zip from http://autoroot.chainfire.eu to the same path | |
# Extract downloaded file archives | |
/path/n4update$ mkdir -p ./images && tar zxvf occam-lrx22c-factory-86c04af6.tgz -C ./images |
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
-- Os dados contidos nesse arquivo foram extraídos do site: http://ibge.gov.br/cidadesat utilizando ruby, nokogiri e expressões regulares. | |
-- Autor: Mauricio Natanael Ferreira | |
-- Github: https://github.com/manfe | |
-- Twitter: @manfe01 | |
-- Email: contato [at] ferreiramauricio [dot] com | |
-- *********************************************************************************************************************************************** | |
-- id ... |
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
# html template | |
{% form_from_page slug %} | |
# template tag | |
from mezzanine import template | |
from mezzanine.forms.forms import FormForForm | |
from mezzanine.pages.models import Page | |
register = template.Library() | |
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
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php | |
$('[placeholder]').focus(function() { | |
var input = $(this); | |
if (input.val() == input.attr('placeholder')) { | |
input.val(''); | |
input.removeClass('placeholder'); | |
} | |
}).blur(function() { | |
var input = $(this); |
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
#!/bin/bash | |
LINES=$(tput lines) | |
COLUMNS=$(tput cols) | |
declare -A snowflakes | |
declare -A lastflakes | |
clear |
NewerOlder