Skip to content

Instantly share code, notes, and snippets.

@interstar
interstar / stuff.txt
Created March 16, 2011 12:38
narcstuff
hi aha
@interstar
interstar / quorascraper.py
Created July 22, 2013 04:15
Quora RSS scraper.
import feedparser
import hashlib
import json
from bs4 import BeautifulSoup
d = feedparser.parse("http://www.quora.com/YOUR-QUORA-NAME/answers/rss")
for e in d["entries"] :
title = e["title"]
summary = e["summary"]
@interstar
interstar / gist:6051618
Last active December 20, 2015 01:49
Quora Scraper: And here's a quick page which takes the files containing my answers that I pulled via RSS and makes an HTML page out of them.
from os import listdir
from os.path import isfile, join
onlyfiles = [ f for f in listdir(".") if isfile(join("",f)) ]
import json
print """
<html>
<style>
body {
#include <Bounce.h>
int anaPin = 5; // Analogue in pin
int button = 2; // button pin
int beepPin = 3; // piezo buzzer
// edges of our calibration window
float aMax;
float aMin;
@interstar
interstar / Sonic Pi sketch
Created April 16, 2016 00:45
Started as a quick play with Sonic Pi to see if I could create functions that process and transform sequences of notes. Grew into a tune.
define :trans do |xs, d|
return xs.collect { |x| (x+d) }
end
ritmo = [0.2,0.4,0.2,0.4]
i = [:c3,:eb3,:g3,:c4,:c3,:eb3,:g3,:c4]
iv = (trans i, 5)
v = (trans i, 7)
@interstar
interstar / gist:33098d0fa9cb843cd9b5300fe9bb9655
Created June 7, 2016 16:29
Useless Things #1 : Five Minutes
# Five Minutes
# requires Phil's Sonic Pi Lib ( https://github.com/interstar/Phil-s-Sonic-Pi-Lib )
section = :a
live_loop :clock do
section=wait_then(1,:b)
puts section
@interstar
interstar / .block
Created March 11, 2017 19:29
Directed Graph Editor
license: mit
@interstar
interstar / gist:fbfd0391e9d33f5a2fb7334398f60ee8
Created July 30, 2017 19:14
Versao services.clj no exemplo de grupo FP de Calango
(ns clojure-web-server.routes.services
(:require [ring.util.http-response :refer :all]
[compojure.api.sweet :refer :all]
[schema.core :as s])
)
(defonce ideias (atom {:id 0 :nome "root" :criancas
[{:id 1 :nome "hello" :criancas {}}]}))
(defn buscar [id ids]
@interstar
interstar / cmdncurse.py
Created June 27, 2012 16:14
Using Python Cmd and Curses Together
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import curses
import curses.textpad
import cmd
def maketextbox(h,w,y,x,value="",deco=None,textColorpair=0,decoColorpair=0):
# thanks to http://stackoverflow.com/a/5326195/8482 for this
nw = curses.newwin(h,w,y,x)
@interstar
interstar / permgen.py
Created February 25, 2012 00:19
Python Permutation Generator : A generator that outputs all permutations of a sequence
def perm(xs) :
if xs == [] :
yield []
for x in xs :
ys = [y for y in xs if not y==x]
for p in perm(ys) :
yield ([x] + p)