Skip to content

Instantly share code, notes, and snippets.

View edsu's full-sized avatar

Ed Summers edsu

View GitHub Profile
@edsu
edsu / bots.py
Created June 23, 2011 20:16
see what your bot traffic is like
#!/usr/bin/env python
"""
Hack to look for user agent strings in typical Apache style log and
count up the number of requests by bots vs non-bots. The list of bot
user agents comes from http://www.user-agents.org/ but has had some
agents added to it, since the user-agents.org list is pretty out of date, e.g.
no Bing?!
"""
@edsu
edsu / buriedsignals.py
Last active January 31, 2023 12:03
Fetch a list of featured web resources from the buriedsignals.com website
#!/usr/bin/env python3
import json
import requests_html
session = requests_html.HTMLSession()
response = session.get('https://buriedsignals.com/')
data = json.loads(response.html.find('#__NEXT_DATA__', first=True).text)
for post in data['props']['pageProps']['spotlights']['posts']:
@edsu
edsu / sherlock.txt
Last active January 4, 2023 01:07
The output of running `public_domains "sherlock holmes"` https://pypi.org/project/public-domains/
comfortable.doublebedded.room
covent.garden.market
wonderfully.silent.house
hatherley.hydraulic.engineer
boscombe.valley.estate
gloves.patentleather.shoes
brilliantly.scintillating.blue
nothing.remarkable.save
homely.little.room
including.outdated.equipment
@edsu
edsu / post
Last active January 3, 2023 16:33
#!/bin/bash
# Set these environment variables and you can create a (text-only) post using
# your favorite command line text editor.
#
# - EDITOR: e.g. vim, emacs, etc
# - MASTODON_POST_HOST: the hostname for our Mastodon account, e.g. chaos.social
# - MASTODON_POST_TOKEN: an app access key with write:statuses permission
#
# See: https://gist.github.com/edsu/aa6f70bb20127b1e18e05dff5e470022
@edsu
edsu / run.sh
Created December 23, 2022 14:44
#!/bin/bash
cd /home/ed/Projects/mastodon_digest/
# get the date
date=`TZ=GMT+24 date +%Y-%m-%d`
# create the output directory
output_dir="/var/www/inkdroid.org/mastodon-digest/$date"
mkdir $output_dir
{
"edit_info": {
"initial": {
"editTweetIds": [
"951424303093944320"
],
"editableUntil": "2018-01-11T12:33:25.123Z",
"editsRemaining": "5",
"isEditEligible": true
}
{
"edit_info": {
"initial": {
"editTweetIds": [
"951426392348090368"
],
"editableUntil": "2018-01-11T12:41:43.240Z",
"editsRemaining": "5",
"isEditEligible": true
}
@edsu
edsu / replies.py
Last active December 7, 2022 18:59
Try to get replies to a particular set of tweets, recursively.
#!/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
11/29/2022, 5:32:57 PM - ntnsndr joined the room
11/29/2022, 5:32:57 PM - ntnsndr made future room history visible to all room members.
11/29/2022, 5:32:57 PM - ntnsndr has prevented guests from joining the room.
11/29/2022, 5:32:57 PM - ntnsndr changed who can join this room.
11/29/2022, 5:32:57 PM - ntnsndr changed the room name to Social.coop wiki.
11/29/2022, 5:33:53 PM - ntnsndr invited @yerald@social.coop
11/29/2022, 5:49:49 PM - @yerald@social.coop joined the room
11/29/2022, 5:54:54 PM - ntnsndr: ** Unable to decrypt: decryption key withheld **
11/29/2022, 5:55:46 PM - @yerald@social.coop: ** Unable to decrypt: decryption key withheld **
11/29/2022, 5:56:25 PM - ntnsndr: ** Unable to decrypt: decryption key withheld **
@edsu
edsu / paradise-lost-domains.txt
Created November 29, 2022 13:09
public_domains "paradise lost" > paradist-lost-domains.txt
cumbrous.elements.earth
vaulted.either.host
without.exteriour.help
creating.derivative.works
reward.though.here
father.without.cloud
project.gutenbergtm.name
unfold.celestial.guide
fierce.strive.here
renowned.alcinous.host