Skip to content

Instantly share code, notes, and snippets.

@sangheestyle
sangheestyle / generate_edge_list.sh
Last active August 29, 2015 14:07
Make biparted graph and projection
authors=(`git log --format='%ae' | sort -u`)
for author in ${author[*]}
do
files=(`git log --no-merges --stat --author="$author" --name-only --pretty=format:"" | sort -u`)
for file in ${files[*]}
do
echo $author $file
done
done
2 1
3 1
3 2
4 1
4 2
4 3
5 1
6 1
7 1
7 5
from pylab import *
import pandas as pd
df =pd.read_csv("PS04_1a.dat", names=range(1,35))
p1 = pd.DataFrame({'max': df.max(), 'mean':df.mean()})
p1.plot(marker='.', markersize=10, title='')
@sangheestyle
sangheestyle / creat_and_drop_table_via_cqlsh
Last active August 29, 2015 14:08
demo: cassandra python driver. make a keyspace and insert, update, delete a repo into repos table
CREATE KEYSPACE unittest WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
USE unittest;
CREATE TABLE commits (
id text,
path text,
author_email text,
author_name text,
subject text,
import numpy as np
import scipy as sc
import networkx as nx
from matplotlib.colors import LogNorm
from pylab import *
def sample(n):
m = sc.misc.comb(n, 2)
r_vals = np.random.random(m)
@sangheestyle
sangheestyle / show_scope.sh
Created November 27, 2014 12:35
Get the scope of given class in a given file and hen show the evelution of the class via git log -L
#!/bin/bash
# Get the scope of given class in a given file
# Then show the evelution of the class via git log -L
# usage: show_scope [classname] [filename]
# cname='class HttpAuthHandler'
# fname='HttpAuthHandler.java'
cname=$1
fname=$2
begin=$(grep -n ".*$cname.*" $fname | grep -Eo "^[0-9]{1,5}")
wget http://hivelocity.dl.sourceforge.net/project/math-atlas/Stable/3.10.2/atlas3.10.2.tar.bz2
tar jxf atlas3.10.2.tar.bz2

  288  tar jxf atlas3.10.2.tar.bz2 
  289  ls
  290  cd ATLAS/
  291  ls
  292  cd ..
  293  clear
@sangheestyle
sangheestyle / README.md
Last active August 29, 2015 14:11 — forked from couchand/README.md

Object selection is tough, particularly when the things you'd like to select are moving around (like nodes in a force-directed layout, perhaps). Allowing a user the fudge factor of an area cursor helps, but can get in the way when targets are small enough. The use of a Voronoi tessellation promises a map of closest node for any given point.

This example illustrates the use of a Voronoi overlay to clip nodes in a force-directed simulation. By using the Voronoi shapes as the clipping path the nodes themselves can be drawn much simpler.

This builds on these two examples from Mike Bostock on force-directed graphs and voronoi tesselation, as well as Nate Vack's Voronoi selection example here and this first pass at an integration from Christopher Manning.

A simple editor to allow the manipulation of force-directed graph parameters.

This example is based on Mike Bostock's block 4062045.

This simple force-directed graph shows character co-occurence in Les Misérables. A physical simulation of charged particles and springs places related characters in closer proximity, while unrelated characters are farther apart. Layout algorithm inspired by Tim Dwyer and Thomas Jakobsen. Data based on character coappearence in Victor Hugo's Les Misérables, compiled by Donald Knuth.

@sangheestyle
sangheestyle / README.md
Created December 10, 2014 07:30
Developers' relationship, take 1

A simple example to show developers' relationship by analyzing commits in AOSP frameworks/base repository. Only commits submitted within past 2 months were used for generating this relationship. You might want to click 'open in a new window' link (right) to see this on larger window.

This graph was built by the following.

  • making edges by developer to his or her modified file (bipartite graph)
  • making projection by developer nodes

Each dot shows each developer and each color of circle represents each company which hires the developer. You can generate the json file by flatiron.

This example is based on Couchand's block 6495846.