Skip to content

Instantly share code, notes, and snippets.

Ed Summers edsu

Block or report user

Report or block edsu

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
@edsu
edsu / replies.py
Last active Jul 15, 2019
Try to get replies to a particular set of tweets, recursively.
View replies.py
#!/usr/bin/env python
"""
Twitter's API doesn't allow you to get replies to a particular tweet. Strange
but true. But you can use Twitter's Search API to search for tweets that are
directed at a particular user, and then search through the results to see if
any are replies to a given tweet. You probably are also interested in the
replies to any replies as well, so the process is recursive. The big caveat
here is that the search API only returns results for the last 7 days. So
View jupyterhub_config.py
# Configuration file for jupyterhub.
import os
#------------------------------------------------------------------------------
# Configurable configuration
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# LoggingConfigurable configuration
#------------------------------------------------------------------------------
View snowflakes.py
#!/usr/bin/env python3
import twarc
# This small script shows how to listen to the Twitter sample stream and
# deconstruct tweet ids into their various components. The tweet_components
# method accepts a tweet id and returns a dict object with key / values
# representing the various components of a tweet id. Each component has its own
# method detailing how values are extracted from the tweet id.
View langdetect_test.py
#!/usr/bin/env python
import csv
from xml.etree import ElementTree
from langdetect import detect_langs
from requests_html import HTMLSession
http = HTMLSession()
def langs(url):
@edsu
edsu / modern-titles-alpha.txt
Created Jun 6, 2019
csvcut -c 2 NSRLProd.txt | perl -nle 's/"//g; print uc(substr($_, 0, 1))' | sort | uniq -c > modern-titles-alpha.txt
View modern-titles-alpha.txt
2 <
60
14 .
6 {
2 ?
3 0
118 1
27 2
50 3
43 4
@edsu
edsu / ios-titles-alpha.txt
Last active Jun 6, 2019
csvcut -c 2 NSRLProd.txt | perl -nle 's/"//g; print uc(substr($_, 0, 1))' | sort | uniq -c > ios-titles-alpha.txt
View ios-titles-alpha.txt
3 `
1 .
4 1
1 6
1 8
88 A
17 B
35 C
22 D
9 E
View followers.py
#!/usr/bin/env python
import sys
import twarc
# usage: followers.py <screen_name>
screen_name = sys.argv[1]
twitter = twarc.Twarc()
@edsu
edsu / drinks.csv
Last active May 14, 2019
% cat ~/irclogs/freenode/#code4lib.log | ./stats.py
View drinks.csv
drink count
Wild Snow Sprout Tea 180
Golden Orchid 173
Honey Black Tea 162
Keemun Full Leaf Tea 134
Bio Pao Chung Pouchong 121
Masala Chai 110
Bi Luo Chun Green Tea (Pi Lo Chun) 104
BH02: Holy Basil Purple Leaf 87
Bao Zhong Oolong Tea 78
View _config.yml
# ==============================================================
# WAX CONFIGURATION
# ==============================================================
# Jekyll configuration files are written in YAML format.
# Colons, tabs/spacing, and quotes are meaningful in YAML.
# It is recommended you look at the following guide to avoid
# syntax errors in this file:
# ~> https://learnxinyminutes.com/docs/yaml/
#
#
View jobs.py
#!/usr/bin/env python3
import re
import csv
import json
import twarc
import string
import collections
jobs = collections.Counter()
You can’t perform that action at this time.