Skip to content

Instantly share code, notes, and snippets.

Avatar

ento

View GitHub Profile
@ento
ento / drmcheck.py
Last active May 11, 2021 — forked from aallan/drmcheck.py
Python script to check encryption status of various types of ebook formats.
View drmcheck.py
#!/usr/bin/python
#
# Changelog
# 1.00 - Initial version, with code from various other scripts.
# 1.01 - Moved authorship announcement to usage section.
# Written in 2011 by Paul Durrant
#
# 1.02 - Added recognition of Apple Fairplay encryption.
# Modified in 2015 by Alasdair Allan
#
@ento
ento / aws-show-monthly-cost.js
Created Jun 17, 2020
Add columns for monthly cost to AWS pricing tables
View aws-show-monthly-cost.js
function findHourlyPriceColumns(table) {
for (const row of table.querySelectorAll("thead tr")) {
const headers = Array.from(row.querySelectorAll("th"));
const columns = headers.reduce(function(acc, current, index) {
if (/hourly/i.test(current.innerText) || /price per hour/i.test(current.innerText)) {
acc.push(index)
}
return acc;
}, []);
if (columns.length > 0) return {hourlyColumns: columns, totalColumns: headers.length};
@ento
ento / NOTES.txt
Created Mar 21, 2020
Failed attempts at shrinking the size of sqitchPg closure in Nix
View NOTES.txt
Attempt 1: Build sqitch with pp
-> built binary still failed with "Can't locate PAR.pm in @INC"
Attemp 2: Install sqitchModule with ./Build bundle
-> Configuring DBD::Pg fails:
> Configuring DBD-Pg-3.10.4 ... N/A
> ! No MYMETA file is found after configure. Your toolchain is too old?
@ento
ento / 01-various-structures.md
Last active Mar 14, 2020
How GitHub renders YAML front matter
View 01-various-structures.md

string: hello mapping: more-mapping: even-more-mapping: hello empty: {} array: - one - two

  • three: 3
@ento
ento / wine_4.nix
Created Feb 20, 2020
Nix overlay for Wine 4
View wine_4.nix
# I thought this might allow running Adobe Digital Editions 2.0.1 but it didn't work.
# Leaving a gist so that I don't need to look up the commit when I need it again.
self: super:
let
pkgsPath = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/8a83fb70d01a953ef72293e0034474a5a93ef3c0.tar.gz";
sha256 = "0f2blhwpy5vbxzrbyykn0jk0da9srgnfv4yaxi3yhmlpinlx84m9";
};
in {
wine_4 = (import pkgsPath { }).wineUnstable;
View jenkins_dustats.py
#!/usr/bin/env python3
import sys
import math
from pathlib import Path
import glob
from collections import namedtuple
from subprocess import run, check_output, PIPE
import csv
View .gitignore
default.nix
node-env.nix
node-packages.nix
View .gitignore
.bundle/
.overcommit.yml
vendor/
@ento
ento / cloudtrail_overview.sh
Last active May 25, 2018
print CloudTrail event counts by username in all regions for the given time range
View cloudtrail_overview.sh
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
if [ "$#" -ne 2 ]; then
echo 'print CloudTrail event counts by username in all regions for the given time range.'
echo 'usage:'
echo " $0" 'start-time end-time'
echo 'example:'
View patch_all_nix_elfs.py
"""
Replace all NEEDEDs of all ELF files in /nix/store with absolute paths.
Requires python-magic.
"""
from __future__ import print_function
import os.path
import subprocess
from collections import namedtuple
import functools