Skip to content

Instantly share code, notes, and snippets.

View katychuang's full-sized avatar

Dr. Kat katychuang

View GitHub Profile
@fredrik
fredrik / centrality.py
Created October 19, 2010 09:27
calculate centrality measures for a network using networkx
#!/usr/bin/env python
import networkx as nx
# for each node:
# + degree centrality
# + closeness centrality
# + betweenness centrality
# + eigenvector centrality
# + page rank
@drewconway
drewconway / twitter_network.py
Created January 17, 2011 18:31
A function, which given a list of Twitter users, creates NetworkX object of relationships.
def twitter_network(users, api, user_type="search", alt_type="friend"):
"""
Given a list of Twitter users, create NetworkX object of relationships.
args: users List of Twitter users as strings
user_types Type string for entries in 'users'
"""
twitter_network=nx.DiGraph()
# Iteratively create network with appropriate type data
users=list(users)
for u in users:
@paulmillr
paulmillr / active.md
Last active July 15, 2024 10:55
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 1000)
@mt3
mt3 / pandas-heroku.md
Created September 8, 2012 23:10 — forked from nicolashery/pandas-heroku.md
Deploy Python app using Pandas on Heroku

Deploy Python app using Pandas on Heroku

2012-09-08

This document explains how to deploy a Python app that uses the Pandas library on Heroku.

Heroku builds Numpy (one of Pandas' requirements) fine. However, when trying to deploy an app with both numpy and pandas in its requirements.txt file (or even just pandas), for some reason it fails

@Nurdok
Nurdok / python_conversion.md
Last active July 11, 2024 15:00
Python Conversion

Python Number Conversion Chart

From To Expression
from cv import * #bad practice, its just that am bit lazy
def GetThresholdedImage(img):
#returns thresholded image of the blue bottle
imgHSV = CreateImage(GetSize(img), 8, 3)
#converts a BGR image to HSV
CvtColor(img, imgHSV, CV_BGR2HSV)
imgThreshed = CreateImage(GetSize(img), 8, 1)
#InRangeS takes source, lowerbound color, upperbound color and destination
#It converts the pixel values lying within the range to 255 and stores it in
@mango314
mango314 / README.md
Last active December 10, 2015 22:38 — forked from mbostock/.block

This choropleth encodes unemployment rates from 2008 with a quantize scale ranging from 0 to 15%. A threshold scale is a useful alternative for coloring arbitrary ranges.

This is a modification of Mike Bostock's example, so single out individual states, picked out using their FIPS code. The State outlines can be also be found on GitHubt @ https://gist.github.com/4090846. A Bottle sever is included, for viewing at home.

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active July 17, 2024 14:20
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@willurd
willurd / web-servers.md
Last active July 22, 2024 15:25
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@AWeg
AWeg / CopyAsanaTasks.php
Last active May 5, 2020 01:04 — forked from mhdhejazi/CopyAsanaTasks.php
main changes: - Asana has own SSL cert -> had to add to lines of code - copies subtasks and up to 11 subtasks of subtasks - copies tags -> only tagnames not followers/descriptions
function asanaRequest($methodPath, $httpMethod = 'GET', $body = null)
{
$apiKey = 'ASANA_API_KEY_HERE'; /// Get it from http://app.asana.com/-/account_api
$url = "https://app.asana.com/api/1.0/$methodPath";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ;
curl_setopt($ch, CURLOPT_USERPWD, $apiKey);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);