Skip to content

Instantly share code, notes, and snippets.

View edsu's full-sized avatar

Ed Summers edsu

View GitHub Profile
@edsu
edsu / swap_check.py
Last active July 13, 2023 16:14
Reads a text file of URLs and writes out a CSV report of whether the URL is in swap.stanford.edu
#!/usr/bin/env python3
import csv
import sys
import json
import time
import requests
def get_snapshots(url):
url = f"https://swap.stanford.edu/was/cdx?url={url}&output=json"
#!/usr/bin/env python
for n in range(0,1002):
with open("files/file-{:04n}.txt".format(n), "w") as fh:
fh.write(str(n))
@edsu
edsu / add_to_pinboard.py
Last active June 4, 2023 09:45
A test of the Pinboard API
#!/usr/bin/env python3
import os
import dotenv
import requests
#
# You'll need to put your Pinboard API token in a .env file in the same directory as this program.
#
# PINBOARD_KEY=abc:123
import csv
import time
from ipwhois import IPWhois
output = csv.DictWriter(open("blocks.csv", "w"), ["ip", "affected", "name", "country", "description"])
output.writeheader()
for line in open("blocks.txt"):
line = line.strip()
@edsu
edsu / template-test.html
Created May 22, 2023 19:21
Small example of a template
<html>
<body>
<div id="root" />
<template id="my-template">
<div>
<input type="text" />
<button>Remove</button>
</div>
</template>
@base <https://id.loc.gov/resources/instances/7977519.nt> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<http://id.loc.gov/resources/instances/7977519>
<http://id.loc.gov/ontologies/bibframe/adminMetadata> [
<http://id.loc.gov/ontologies/bflc/encodingLevel> <http://id.loc.gov/vocabulary/menclvl/1> ;
<http://id.loc.gov/ontologies/bibframe/assigner> <http://id.loc.gov/vocabulary/organizations/dlc> ;
<http://id.loc.gov/ontologies/bibframe/changeDate> "2010-06-14T09:46:36"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
<http://id.loc.gov/ontologies/bibframe/creationDate> "1973-05-11"^^<http://www.w3.org/2001/XMLSchema#date> ;
<http://id.loc.gov/ontologies/bibframe/descriptionAuthentication> <http://id.loc.gov/vocabulary/marcauthen/premarc> ;
class Example:
def __init__(self):
self.var = 1
def run(self):
return self.var
@edsu
edsu / solarwinds-tweeted-urls.csv
Last active April 29, 2023 07:48
This is a count of URLs that were tweeted in this SolarWinds dataset https://catalog.docnow.io/datasets/20201230-solarwinds/ URLs were unshortened with https://github.com/docnow/unshrtn
We can't make this file beautiful and searchable because it's too large.
url,tweets
https://www.nytimes.com/2020/12/16/opinion/fireeye-solarwinds-russia-hack.html,5502
https://web.archive.org/web/20201213230906/https://www.solarwinds.com/company/customers,3460
https://www.thegatewaypundit.com/2020/12/breaking-fbi-texas-rangers-us-marshals-raid-solarwinds-hq-austin/,2372
https://www.fireeye.com/blog/threat-research/2020/12/evasive-attacker-leverages-solarwinds-supply-chain-compromises-with-sunburst-backdoor.html,1559
https://www.geekwire.com/2020/microsoft-unleashes-death-star-solarwinds-hackers-extraordinary-response-breach/,1317
https://www.reuters.com/article/us-global-cyber-microsoft-idUSKBN28R3BY,955
https://www.cisa.gov/news/2020/12/13/cisa-issues-emergency-directive-mitigate-compromise-solarwinds-orion-network,805
https://blogs.microsoft.com/on-the-issues/2020/12/17/cyberattacks-cybersecurity-solarwinds-fireeye/,706
https://www.reuters.com/article/us-usa-solarwinds-cyber-idUSKBN28N0Y7,661
@edsu
edsu / rb-loc.md
Last active April 14, 2023 02:15
Project Lines of Ruby
happy-heron 46866
argo 41683
dor-services-app 27461
preservation_catalog 24798
sul_pub 17958
hydra_etd 13837
pre-assembly 9038
dor_indexing_app 8070
sequenceDiagram
Note over Client: User clicks Download and the button text changes to "initiating download"
Client->>Server: POST  /object/sg052hd9120 
Server-->>Client: HTTP 201 Location: /jobs/12345
Note over Client: Client begins polling to see if ZIP is ready
Client->>Server: GET /jobs/12345
Server-->>Client: HTTP 200 { status: queued }
Client->>Server: GET /jobs/12345
Server--&gt;&gt;Client: HTTP 200 { status: running }