Skip to content

Instantly share code, notes, and snippets.

View ento's full-sized avatar

ento

View GitHub Profile
@ento
ento / NOTES.txt
Created March 21, 2020 00:04
Failed attempts at shrinking the size of sqitchPg closure in Nix
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 March 14, 2020 04:52
How GitHub renders YAML front matter

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

  • three: 3
@ento
ento / wine_4.nix
Created February 20, 2020 16:54
Nix overlay for Wine 4
# 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;
#!/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
default.nix
node-env.nix
node-packages.nix
@ento
ento / .gitignore
Last active October 31, 2018 19:45
.bundle/
.overcommit.yml
vendor/
@ento
ento / cloudtrail_overview.sh
Last active May 25, 2018 17:16
print CloudTrail event counts by username in all regions for the given time range
#!/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:'
@ento
ento / gist:903098
Created April 5, 2011 05:57
Steps to install pep8 pre-commit hook managed by git-hooks
# Repository developers
cd /path/to/somewhere
git clone https://github.com/kergoth/git-hooks
export PATH=/path/to/somewhere/git-hooks:$PATH
cd /path/to/project
git hooks --install
@ento
ento / gist:1525902
Created December 28, 2011 02:37
Calculate the total length of music/sound files in a folder
import re
import glob
import commands
duration_re = re.compile(r'(?P<hour>\d+):(?P<minute>\d+):(?P<second>\d+\.\d+),')
hour = minute = second = 0.0
for f in glob.glob("./*"):
s = commands.getstatusoutput('ffmpeg -i %s 2>&1 | egrep "Duration" | cut -d " " -f 4' % f)[1]
m = duration_re.match(s)
@ento
ento / gist:6375397
Created August 29, 2013 08:04
Iterate through logs captured by nosetest's logcapture plugin
import logging
from nose.plugins import logcapture
def iter_captured_logs(pluck=None):
handler = get_nose_log_handler()
# need to call `format` in order to let it compose the `message` attr for us
format = handler.format
for r in handler.buffer:
format(r)