These are the current filters.
[Errno 54] Connection reset by peer
when using pytest You can run a TCP server in the background using a fixture, and using the SO_LINGER
socket option can reset the connection.
Disabling JavaScript when you open the webarchive file will prevent you from redirecting you to twitter.com.
Adding Data.WritingOptions.withoutOverwriting
to your write()
call will prevent you from overwriting a file that already exists.
The inside of a .webarchive
file is a binary property list with the complete responses and some request metadata.
Wrapping a Palette:Srgb
in a struct and implementing FromStr
for the struct allows you to take hexadecimal colours as command-line inputs.
You can do some fun stuff with the --write-out
flag and variables.
The song Seasons of Love from Rent starts with the line “Five hundred twenty-five thousand, six hundred minutes”.
Using a nested query allows me to perform a two-level aggregation of the values in a column – how many values appear once, how many twice, and so on.
Use the CDX Server API to get a list of captures for a particular URL.
Using Playwright to take screenshots and adding some custom styles gets a screenshot of a page without the Wayback Machine overlay.
Using the During
filter gives me a count of how many messages were being sent.
To see exactly what HTTP requests were being made, I modified the library so that betamax would record requests.
Modern browsers allow you to embed the SVG almost as-is, with just a couple of characters that need escaping – no base64 required!
If you want an array in random order, you can use the sample
filter to get a random sample of the same size as the original array.
When you make an HTTP request, you can use the If-Modified-Since
header to get a 304 Not Modified if nothing has changed since your last request.
open
command can ask questions If you pass an argument that can’t be easily identified as a file or a URL, open
will ask you what to do next. This may be a surprise if you were trying to use it in a script.
Images can have orientation specified in their EXIF metadata, which isn’t preserved when you open and save an image with Pillow.
Escaping the pipe like [[filename\|display text]]
allows you to customise the of a link in a table.
Why I use Sessions in boto3, and the Python function I use to create them.
The flags and arguments I find useful when I’m using youtube-dl.
-n
/-i
flags to avoid overwriting files with cp
and mv
errexit
and arithmetic expressions in bash tmutil addexclusion
resp.close()
to close the file opened by send_file()
-v
flag to see what rm
is deleting {% raw %}
tag to describe Liquid in Liquid If you’re trying to write about using Liquid tags in a Liquid-based site, wrapping your tags in the {% raw %}
tag will prevent them being rendered.
test -n
with command expansion MaxMind offer databases you can do to look up IP addresses without sending the address off to a remote service.
{% capture %}
tag to assign complex strings to variables If you want to get a string that’s semi-complicated to construct, you can put a “mini-template” in the {% capture %}
tag to build it over multiple lines.
appendChild()
<details>
element differently depending on whether it’s open or closed cp
or mv
a file to it "do JavaScript"
<img>
that points to another file By reading the code for the pytest-random-order
plugin, I was able to write a new plugin that runs a random subset of tests.
You can use sqlite-utils on the command line to create a SQLite database from a CSV file.
The sqlite3.connect(…)
context manager will hold connections open, so you need to remember to close it manually or write your own context manager.
Calling browser.set_ca_data(cafile=certifi.where())
will tell where mechanize can find some local SSL certificates.
The XML-to-JSON conversion leads to some inconsistent behaviour, especially in corner cases of the API.
Following the logged-out 302 Redirect takes you to the original post.
You can use Srgb::from_str()
to parse a hexadecimal string as a colour in the palette crate.
git check-ignore
to debug your .gitignore
Running git check-ignore --verbose <PATH>
will tell you which rule applies to a given path, and where that rule is defined.
Instructions for setting the time of day on my boiler clock.
If you add /podcast
to a Tumblr site, you get a podcast-like RSS feed for all the external audio posts on that site.