Skip to content

Instantly share code, notes, and snippets.

View josenaves's full-sized avatar

José Naves Moura Neto josenaves

View GitHub Profile
import urlparse
import oauth2 as oauth
consumer_key = ''
consumer_secret = ''
request_token_url = 'http://www.tumblr.com/oauth/request_token'
access_token_url = 'http://www.tumblr.com/oauth/access_token'
authorize_url = 'http://www.tumblr.com/oauth/authorize'
/*
Instructions:
1. Log in with your account and go to the desired course
2. Open the courseware tab
3. Configure the week variable
4. Copy this code and paste it in the browser console
*/
@josenaves
josenaves / gist:6040590
Created July 19, 2013 16:42
Insert ... select in mongodb
use admin_loja;
db.planos.find().forEach( function(plano) {
if (typeof(plano.deals) != 'undefined') {
for (i = 0; i < plano.deals.length; i++) {
produtos = plano.deals[i].produtos;
import urllib, json
author = 'Youtube_Username'
foundAll = False
ind = 1
videos = []
while not foundAll:
inp = urllib.urlopen(r'http://gdata.youtube.com/feeds/api/videos?start-index={0}&max-results=50&alt=json&orderby=published&author={1}'.format( ind, author ) )
try:
resp = json.load(inp)
@josenaves
josenaves / jekyll-installation
Last active December 24, 2015 22:28
Jekyll Installation
jnaves@skynet:~$ rvm install 1.9.2
Searching for binary rubies, this might take some time.
No binary rubies available for: debian/wheezy_sid/x86_64/ruby-1.9.2-p320. Continuing with compilation. Please read ‘rvm help mount’ to get more information on binary rubies.
Checking requirements for debian. Installing requirements for debian.
Hit http://br.archive.ubuntu.com precise Release.gpg
Hit http://br.archive.ubuntu.com precise-updates Release.gpg
Hit http://br.archive.ubuntu.com precise-backports Release.gpg
jnaves@skynet:~/Apps$ git clone https://github.com/thomasf/exitwp
Cloning into 'exitwp'...
remote: Counting objects: 253, done.
remote: Compressing objects: 100% (135/135), done.
remote: Total 253 (delta 134), reused 225 (delta 110)
Receiving objects: 100% (253/253), 45.39 KiB, done.
Resolving deltas: 100% (134/134), done.
jnaves@skynet:~/Apps/exitwp$ sudo pip install --upgrade -r pip_requirements.txt
jnaves@skynet:~/Apps/exitwp$ python exitwp.py
reading: wordpress-xml/worpress.xml
Traceback (most recent call last):
File "exitwp.py", line 361, in <module>
data = parse_wp_xml(wpe)
File "exitwp.py", line 82, in parse_wp_xml
root = tree.parse(file, parser)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 656, in parse
parser.feed(data)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1643, in feed
@josenaves
josenaves / eclipse.desktop
Created March 10, 2014 17:52
Launcher file for Ubuntu derivatives
[Desktop Entry]
Name=Eclipse
Type=Application
Exec=eclipse
Terminal=false
Icon=eclipse
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE;
Name[en]=Eclipse
@josenaves
josenaves / ngRoute
Created March 30, 2014 00:02
Adding ngRoute as a dependency for a module
var serviceApp = angular.module('ep10App', ['ngRoute']);
@josenaves
josenaves / Routes
Created March 30, 2014 00:04
Route - $routeProvider configuration
serviceApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/states', { templateUrl: 'list.html', controller: 'controllerEp10'}).
when('/create', { templateUrl: 'create.html', controller: 'controllerEp10'}).
when('/delete', { templateUrl: 'list.html', controller: 'controllerEp10'}).
otherwise({
redirectTo: '/states'
});
}