Skip to content

Instantly share code, notes, and snippets.

View arthurnn's full-sized avatar
🟢
CI is passing

Arthur Nogueira Neves arthurnn

🟢
CI is passing
View GitHub Profile
@arthurnn
arthurnn / gist:1064993
Created July 5, 2011 14:55
PIL error in MAC OS
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 July 24, 2011 03:23
threadless wallpaper
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 July 28, 2011 21:20
FilterIteratorImpl
/* only output for valid = true */
interface FilterIterator {
public boolean hasNext();
public Object next();
}
interface Filter {
boolean valid(Object o);
}
@arthurnn
arthurnn / gist:1204385
Created September 8, 2011 19:12
stackoverflow
<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 December 2, 2011 22:56
Script to fetch and CBC rss feed and count the words
#!/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 December 3, 2011 01:35
This is the main file for Kik
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 January 23, 2012 23:26
Alphabet Soup solution for Facebook HackerCup
#!/usr/bin/env python
# encoding: utf-8
"""
Created by @arthurnn
"""
import sys
import os
import fileinput
@arthurnn
arthurnn / pwm.py
Created February 27, 2012 02:58
beaglebone PWM
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
#!/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 June 22, 2012 01:37
Fetch Movies for ios5
- (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;