Skip to content

Instantly share code, notes, and snippets.

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
@sergiobuj
sergiobuj / solution_for_gs.py
Last active August 29, 2015 14:04
New graph from the SCC
## Tarjan implementation from Wikipedia's pseudocode
def tarjan(graph):
#input: graph G = (V, E)
#output: set of strongly connected components (sets of vertices)
n = len(graph)
sccs = []
index = [0]
indexes = [-1] * n
lows = [float('Inf')] * n
S = []
@sergiobuj
sergiobuj / clusterpysal.ipynb
Last active August 29, 2015 14:02
What if we could use [the amazing] Clusterpy on top of Pysal?
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sergiobuj
sergiobuj / README.md
Last active August 29, 2015 14:01
Working vagrant base box with python dev tools included.

Create custom Vagrant base boxes

About ipyvmbase:

  • Debian 7.5
  • build-essentials and git
  • ipython notebook
  • numpy
  • scipy
  • matplotlib
  • pandas
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sergiobuj
sergiobuj / gist:8962775
Created February 12, 2014 19:29
Clusterpy loves Matplotlib
{
"metadata": {
"name": "clusterpy loves matplotlib"
},
"nbformat": 2,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
@sergiobuj
sergiobuj / tour71.golang.go
Last active January 13, 2016 22:27
Exercise: Web Crawler In this exercise you'll use Go's concurrency features to parallelize a web crawler. Modify the Crawl function to fetch URLs in parallel without fetching the same URL twice. http://tour.golang.org/#71
package main
import (
"fmt"
"time"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
@sergiobuj
sergiobuj / 0_data.csv
Last active December 26, 2015 02:09
Chart cloning 0
Week cat dog fish
2012-01-01 - 2012-01-07 56 92 59
2012-01-08 - 2012-01-14 59 91 56
2012-01-15 - 2012-01-21 55 91 56
2012-01-22 - 2012-01-28 56 89 54
2012-01-29 - 2012-02-04 58 89 55
2012-02-05 - 2012-02-11 60 94 54
2012-02-12 - 2012-02-18 56 98 54
2012-02-19 - 2012-02-25 58 91 58
2012-02-26 - 2012-03-03 59 85 54
## How to Use:
from radar import radar_graph
labels = ['v1', 'v2', 'v3', 'v4', 'v5', 'v6', 'v7', 'v8', 'v9']
values = [1, 1, 2, 7, 4, 0, 3, 10, 6]
optimum = [5, 3, 2, 4, 5, 7, 5, 8, 5]
radar_graph(labels, values, optimum)
@sergiobuj
sergiobuj / fast_clusterpy.condor
Last active June 11, 2020 16:15
Condorfy like a pro
# RiSE Group - Sergio B
# Condor description file
Notify_user = condorjobs@sbuj.co
Universe = vanilla
Executable = /opt/python/bin/python2.7
Arguments = performance_script.py
Log = log/fast_performance.log.$(Cluster)