Skip to content

Instantly share code, notes, and snippets.

View fernandojunior's full-sized avatar

Fernando Felix fernandojunior

View GitHub Profile
@fernandojunior
fernandojunior / gist:7866864
Last active December 30, 2015 18:19
Shell script to install pip, virtualenv and virtualenvwrapper on ubuntu
#!/bin/bash
#install pip
sudo apt-get install python-pip
#install virtualenv
sudo pip install virtualenv
#install virtualenvwrapper
@fernandojunior
fernandojunior / gist:7869120
Created December 9, 2013 08:33
Retrieving images recursively with wget
# http://www.gnu.org/software/wget/manual/wget.html#Types-of-Files
wget -r -A .jpg,png http://url.com
@fernandojunior
fernandojunior / gist:63c6c676f6e16a1a7f0e
Last active March 26, 2016 06:32
Simple ORM with Python and SQLite.
@fernandojunior
fernandojunior / gist:45efd7f525338a82475c
Last active August 29, 2015 14:01
Aplicação Web Restful simples utilizando o microframework Flask e a extenção Flask-Classy
from flask import Flask, g, request, jsonify, abort # http://flask.pocoo.org/
from flask.ext.classy import FlaskView # http://pythonhosted.org/Flask-Classy/
from db import DatabaseConnection, BaseManager, BaseEntity # https://gist.github.com/fernandojunior/63c6c676f6e16a1a7f0e
"""
Aplicação Web Restful simples utilizando o microframework Flask e a extenção Flask-Classy
Author Fernando Felix do Nascimento Junior
Gist https://gist.github.com/fernandojunior/45efd7f525338a82475c
"""
@fernandojunior
fernandojunior / gist:857c9926ad4de671bc0e
Created June 4, 2014 07:06
Funções JavaScript que recuperam parametros da url
/**
* Retorna o valor de um parametro da url
* @param name Nome do parametro
* @ref http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
**/
function getParameter(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? null : decodeURIComponent(results[1].replace(/\+/g, " "));
Hello World
@fernandojunior
fernandojunior / gist:5166fc6f92354cc950c9
Last active May 9, 2016 15:53
A modified Parse.FacebookUtils to use with the modified openFB
/**
* Based on Parse.FacebookUtils. A provider for use the modified openFB in Parse.
* @author Fernando Felix do Nascimento Junior*
**/
(function(root) {
root.Parse = root.Parse || {};
var Parse = root.Parse;
var _ = Parse._;
var PUBLIC_KEY = "*";
@fernandojunior
fernandojunior / gist:3e8abd7bb4098d702d92
Last active August 29, 2015 14:06
Solution in Python for the first codingame trannig
# The code below will read all the game information for you.
# On each game turn, information will be available on the standard input, you will be sent:
# -> the total number of visible enemies
# -> for each enemy, its name and distance from you
# The system will wait for you to write an enemy name on the standard output.
# Once you have designated a target:
# -> the cannon will shoot
# -> the enemies will move
# -> new info will be available for you to read on the standard input.
"""
# instalacao no ubuntu
apt-get install git
# iniciar git no diretorio
git init
# relaciona um repositorio remoto ao diretorio "origin"
git remote add origin git@github.com:account/repository_name.git
# puxa a branch "master" do repositorio para o diretorio "origin"
@fernandojunior
fernandojunior / gist:3130b8de3b1c6f77db10
Created October 10, 2014 21:10
Virtual ssh directory
mkdir -p /path/to/somewhere/hostbdir
sshfs user@hostb:/path/to/some/dir/on/hostb /path/to/somewhere/hostbdir
# to unmount it you can do
fusermount -u /path/to/somewhere/hostbdir
# http://www.linuxquestions.org/questions/linux-software-2/how-does-one-make-a-virtual-ssh-directory-4175424521/