Skip to content

Instantly share code, notes, and snippets.

Arthur Nogueira Neves arthurnn

Block or report user

Report or block arthurnn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@arthurnn
arthurnn / gist:1064993
Created Jul 5, 2011
PIL error in MAC OS
View gist:1064993
Downloading/unpacking PIL
Running setup.py egg_info for package PIL
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
Installing collected packages: PIL
Running setup.py install for PIL
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/opt/local/include/freetype2 -IlibImaging -I/opt/local/include -I/Users/arthurnn/Envs/myblog/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _imaging.c -o build/temp.macosx-10.6-universal-2.6/_imaging.o
_imaging.c:3017: warning: initia
@arthurnn
arthurnn / threadless.py
Created Jul 24, 2011
threadless wallpaper
View threadless.py
from PIL import Image
import urllib
import cStringIO
import re
import sys
URL = sys.argv[1]
ratio = 1
size = (1440,900)
@arthurnn
arthurnn / gist:1112592
Created Jul 28, 2011
FilterIteratorImpl
View gist:1112592
/* only output for valid = true */
interface FilterIterator {
public boolean hasNext();
public Object next();
}
interface Filter {
boolean valid(Object o);
}
View gist:1204385
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
var json_Album_URI = "https://picasaweb.google.com/data/feed/base/"
+ "user/" + "thewoodsmyth"
+ "?alt=" + "json"
+ "&kind=" + "album"
@arthurnn
arthurnn / kik.py
Created Dec 2, 2011
Script to fetch and CBC rss feed and count the words
View kik.py
#!/usr/bin/env python
import threading,thread
from lxml import etree, html
import urllib
from StringIO import StringIO
# mapper function
def mapper(document):
words = document.split()
for w in words:
@arthurnn
arthurnn / Kik.java
Created Dec 3, 2011
This is the main file for Kik
View Kik.java
package com.arthurnn;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import javax.xml.parsers.DocumentBuilder;
@arthurnn
arthurnn / soup.py
Created Jan 23, 2012
Alphabet Soup solution for Facebook HackerCup
View soup.py
#!/usr/bin/env python
# encoding: utf-8
"""
Created by @arthurnn
"""
import sys
import os
import fileinput
@arthurnn
arthurnn / pwm.py
Created Feb 27, 2012
beaglebone PWM
View pwm.py
from mmap import mmap
import struct
MMAP_OFFSET = 0x44c00000 # base address of registers
MMAP_SIZE = 0x48ffffff-MMAP_OFFSET # size of the register memory space
CM_PER_BASE = 0x44e00000 - MMAP_OFFSET
CM_PER_EPWMSS1_CLKCTRL = CM_PER_BASE + 0xcc
CM_PER_EPWMSS0_CLKCTRL = CM_PER_BASE + 0xd4
CM_PER_EPWMSS2_CLKCTRL = CM_PER_BASE + 0xd8
View robot
#!/usr/bin/python
# -- must be run as root
import time
# put Port 8 Pin 3 into mode 7 (GPIO)
open('/sys/kernel/debug/omap_mux/gpmc_ad6', 'wb').write("%X" % 7)
# put Port 8 Pin 4 into mode 7 (GPIO)
open('/sys/kernel/debug/omap_mux/gpmc_ad7', 'wb').write("%X" % 7)
# Port 9 pin Pin 14 (EHRPWM1A)
open('/sys/kernel/debug/omap_mux/gpmc_a2', 'wb').write("%X" % 6)
@arthurnn
arthurnn / gist:2969703
Created Jun 22, 2012
Fetch Movies for ios5
View gist:2969703
- (void)fetchMovies
{
__block NSString * url = @"http://sg.media-imdb.com/suggests/h/hello.json";
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];
[request setHTTPMethod:@"GET"];
NSHTTPURLResponse *response;
NSError *error = nil;
You can’t perform that action at this time.