Skip to content

Instantly share code, notes, and snippets.

View machawk1's full-sized avatar

Mat Kelly machawk1

View GitHub Profile
@weiglemc
weiglemc / capture-requests.py
Created January 18, 2023 21:36
Python script using selenium-wire to render a webpage and capture specific requests that it generates
# run the script on a set of URI-Ms:
# python3 capture-requests.py < to-request.txt >> requests-log.txt
# process the results and generate a new list of URI-Ms that were requested:
# awk '{if ($1 ~ /cnn\.com(:80)?[\/]+$/ && $2 == "200") print $0}' requests-log.txt | sort -t '/' -k 5 >! requests.txt
# https://pypi.org/project/selenium-wire/#installation
import sys
import time
from seleniumwire import webdriver # Import from seleniumwire
@prologic
prologic / LearnGoIn5mins.md
Last active July 3, 2024 04:05
Learn Go in ~5mins
@N0taN3rd
N0taN3rd / nukeBloggerClickTrap.js
Created April 27, 2018 20:29
Remove the annoying blogger preview click trap element.
// what substring in the URL indicates to us that we are editing the blog post
let isPostPreview = 'post-preview'
// the query selector to use for referencing the click trap element
let querySelectorForClickTrap = '.blogger-clickTrap'
// how long should the delay be before we attempt to remove the click trap element
let wait = 3000
if (window.location.href.indexOf(isPostPreview) !== -1) {
setTimeout(() => {
console.log('nukeClickTrap')
let it = document.querySelector(querySelectorForClickTrap)
@N0taN3rd
N0taN3rd / check_margins.sh
Created April 27, 2018 08:16
Appease the margin police at all costs
#!/usr/bin/env bash
####
# Original version of this file was created by Dr. Chuck Cartledge
# as a make file and can be found in his WS-DL blog post:
# https://ws-dl.blogspot.com/2014/07/2014-0-7-2-ode-to-margin-police-or-how.html
####
#### Set these variables to match your setup
CHECK="msThesis"
@N0taN3rd
N0taN3rd / README.md
Last active April 23, 2018 20:44
Selectively Compile Latex Documents

The subfile package is a much more efficient way to bring in the sub parts of a large latex document.

Each part of the complete document that is split up into its own text file brought is added to the document from the main tex file via

\subfile{file} 

Each subfile has the following structure

\documentclass[main.tex]{subfiles}

install solr and create a core (books)

brew install solr
solr start
solr create -c books -d /usr/local/Cellar/solr/7.2.1/example/files/conf

index a pdf

post -c books /tmp/gabriella-giannachi-archive-everything-mapping-the-everyday.pdf
@atomotic
atomotic / readme.md
Last active October 19, 2017 04:29
poor man's WARC viewer

InterPlanetary Version Control (call it IPVC?)

IPLD-based Version History

This is just a sketch of a possibility. If we just want a git-style toolchain with git version graph, it might be better to just put an ipfs storage adapter behind go-git -- basically putting IPFS unixfs trees where git usually creates git tree objects. In that case you would have regular git commit objects, not IPLD objects. That would be less reusable beyond the git context but it would fit better with existing git-based tooling.

Keep in mind: it will be really useful to be able to use IPFS files api to manipulate these trees, allowing you to do things like modify part of a large dataset and commit the changes without ever pulling the whole dataset -- you can just pull the parts that you're changing.

Features

@anjackson
anjackson / sha1b32.sh
Created November 18, 2015 22:03
Calculate the Base32-encoded SHA-1 digest of a file at the command line.
openssl dgst -sha1 -binary $1 | python -c "import base64,sys; print base64.b32encode(sys.stdin.read())"
@Zearin
Zearin / python_decorator_guide.md
Last active July 24, 2024 03:06
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].