Skip to content

Instantly share code, notes, and snippets.

View ptoche's full-sized avatar
💭
fooling around

Patrick Toche ptoche

💭
fooling around
  • strange indentations
  • I live in Hong Kong in the U.S. time zone, but my heart is still in Europe.
View GitHub Profile
@rlucioni
rlucioni / senate-vote-graph.py
Last active August 10, 2022 08:59
Senate Vote Scraper and Graph Builder
import json
from itertools import combinations
import requests
import networkx as nx
def get_senate_vote(vote):
# Year can be replaced to fetch votes from different years (e.g., 2013). 1989 is used
# as an example.
@jennybc
jennybc / reverse-categorical-axis-ggplot2.r
Created October 10, 2014 01:06
Reverse the order of a categorical axis in ggplot2
scale_x_discrete(limits = rev(levels(the_factor)))
@jdudek
jdudek / convert.rb
Created January 31, 2011 19:28
Convert Opera's .adr address book to CSV
# ruby 1.9.2
require "csv"
File.open("contacts2.adr", "r") do |f|
contacts = []
f.read.split("#CONTACT").each do |entry|
unless entry.empty?
contact = {}
entry.each_line do |line|