Skip to content

Instantly share code, notes, and snippets.

Shawn Graham shawngraham

Block or report user

Report or block shawngraham

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@shawngraham
shawngraham / network-message.nlogo
Created Mar 25, 2019
message-on-a-network for netlogo
View network-message.nlogo
View jesuits-groove.rb
#require 'csv'
#data = CSV.parse(File.read("/Users/shawngraham/jesuit/jes2.csv"), {:headers => true, :header_converters => :symbol})
#trying to get a bit more performative with the sonic-pi. Two columns of topics.
use_bpm 50
live_loop :amen_break do
sample :loop_amen, beat_stretch: 2 #,cutoff: 70
sleep 2
end
View trading-pots-on-a-network.netlogo
View text-to-csv.bat
@echo off
setlocal EnableDelayedExpansion
if exist result.csv del result.csv
for %%f in (*.txt) do (
set i=0
for /F "delims=" %%l in (%%f) do (
set /A i+=1
set line!i!=%%l
)
echo %%f, !line1!, !line2!, >> result.csv
@shawngraham
shawngraham / earth.py
Created Mar 5, 2019
grabbing cambridge airphotos
View earth.py
from bs4 import BeautifulSoup
import csv
import requests
file = open("output.txt", "w")
# f = csv.writer(open("output.csv", "w"))
# f.writerow(["domain", "fulllink"])
pages = []
View netlogo-commits.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View netlogo-commits
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: %3 Pages: 1 -->
<svg width="1996pt" height="58947pt"
viewBox="0.00 0.00 1995.62 58947.45" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 58943.4457)">
@shawngraham
shawngraham / textreuse.r
Last active Dec 7, 2018
walking through textreuse for andrew
View textreuse.r
# use ctrl+enter to run each line in turn
install.packages("textreuse")
# next line just displays the help file for the package in the help window in R studio
vignette("textreuse-introduction", package = "textreuse")
setwd("full-path-to-the-directory-you're-working-in")
# check what directory you're in
@shawngraham
shawngraham / ldavis-for-tweets.r
Created Dec 17, 2015
R script for lda topic model of my tweets, then visualized with ldaVIS package.
View ldavis-for-tweets.r
setwd("/Users/shawngraham/Desktop/data mining and tools/tweetsdec17")
# install.packages("rio")
library("rio")
# install.packages("tm")
library(tm)
options(java.parameters = "-Xmx5120m")
##importing opencontext site diaries
importdocs <- lapply("tweets.csv", readLines) ## change this to the version that doesn't have the date columns, or figure out how to tell r to just grab the text column
## or rather, maybe just the year column, because that becomes a word, in which case might see some interesting patterns
View imagetest.csv
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
https://farm3.staticflickr.com/5310/5898076654_51085e157c_o.jpg
https://c1.staticflickr.com/1/67/197493648_628a7cb2ee_o.jpg
https://c7.staticflickr.com/8/7056/7143870979_83a291e780_o.jpg
https://farm5.staticflickr.com/5128/5301868579_f042b35323_o.jpg
https://c6.staticflickr.com/4/3930/15342460029_6f441b0439_o.jpg
https://c7.staticflickr.com/1/668/21529344631_4bdf3c253a_o.jpg
https://farm3.staticflickr.com/3892/14587227141_d36fa37264_o.jpg
https://c5.staticflickr.com/5/4024/4323769914_8f7b8a4a55_o.jpg
https://c5.staticflickr.com/4/3871/14594283694_43c91ce7f9_o.jpg
https://c4.staticflickr.com/8/7335/12405729553_4d56279bcc_o.jpg
You can’t perform that action at this time.