Skip to content

Instantly share code, notes, and snippets.

@drewconway
drewconway / twitter_word_cloud.R
Created January 31, 2011 00:16
R function to create a comparative word cloud of two twitter hashtags, as introduced here http://www.drewconway.com/zia/?p=2624
# File-Name: twitter_word_cloud.R
# Date: 2011-01-30
# Author: Drew Conway
# Email: [email protected]
# Purpose: Create a comparative word cloud of two twitter hashtags
# Data Used:
# Packages Used: twitteR, tm, ggplot2
# Output File: Hashtag word cloud
# Data Output:
# Machine: Drew Conway's MacBook Pro
@hrldcpr
hrldcpr / tree.md
Last active September 1, 2024 07:04
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@brandonb927
brandonb927 / osx-for-hackers.sh
Last active November 14, 2024 17:18
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@lost-theory
lost-theory / gist:3925738
Created October 21, 2012 04:29
different delimiters in jinja2 + flask
from flask import Flask, render_template_string, request
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy()
jinja_options.update(dict(
block_start_string='<%',
block_end_string='%>',
variable_start_string='%%',
variable_end_string='%%',
comment_start_string='<#',
@dsparks
dsparks / tapered-intensity-curved_edges.R
Last active December 8, 2021 12:23
Beautiful tapered-intensity-curved edge network graph with ggplot2
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("sna", "ggplot2", "Hmisc", "reshape2")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Empty ggplot2 theme
new_theme_empty <- theme_bw()
new_theme_empty$line <- element_blank()
new_theme_empty$rect <- element_blank()
new_theme_empty$strip.text <- element_blank()
@phil-pedruco
phil-pedruco / index.html
Created September 21, 2013 03:11
NYC Boroughs in d3
<!DOCTYPE html>
<meta charset="utf-8">
<style>
#boroughs {
stroke: grey;
stroke-width: 2px;
fill: steelblue;
}
</style>
@rothgar
rothgar / install-tmux
Last active August 19, 2024 07:37 — forked from ekiara/how_to_install_tmux_on_centos
Install tmux 1.9 on rhel/centos 6
# Install tmux on Centos release 6.5
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
curl -OL https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/local
var args= require('system').args;
var webPage = require('webpage');
var page = webPage.create();
if(args.length <3) {
console.log("USAGE: phantomjs.exe scrapepage.js url sql\n");
console.log('ie.: phantomjs.exe scrapepage.js "https://news.ycombinator.com/news" "select nodeName,href,innerText from document where className=\'storylink\'"');
phantom.exit();
}
@jbwhit
jbwhit / example-ruff-formatting.ipynb
Last active October 31, 2024 07:22
Steps to use `ruff` in JupyterLab with the `jupyterlab_code_formatter` plugin.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.