Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
# 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 |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#!/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 |
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='<#', |
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() |
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
#boroughs { | |
stroke: grey; | |
stroke-width: 2px; | |
fill: steelblue; | |
} | |
</style> |
# 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(); | |
} |