Skip to content

Instantly share code, notes, and snippets.

@boronine
boronine / edn-vs-json.cljs
Created May 15, 2015 08:23
EDN vs JSON parsing speed
; lein new mies-node edn-vs-json
; vim edn-vs-json/src/edn_vs_json/core.cljs
; lein cljs build once
; node run.js
(ns edn-vs-json.core
(:require
[cljs.nodejs :as nodejs]
[cljs.reader :as reader]
[clojure.string :as string]))
@boronine
boronine / shebang.py
Last active February 22, 2018 15:42
Test maximum shebang length
import os
import stat
import tempfile
import subprocess
shebang_prefix = '#!/usr/bin/env DUMMY=x'
shebang_suffix = ' python\n'
shebang_length_min = len(shebang_prefix) + len(shebang_suffix)
TEST_FILE_HANDLE, TEST_FILE = tempfile.mkstemp('.py')
@boronine
boronine / sentry2csvUA.py
Created June 17, 2020 03:09
Original: https://github.com/sparkmeter/sentry2csv (modified for User-Agent extraction)
#!/usr/bin/env python3
"""Export a Sentry project's issues to CSV."""
import argparse
import asyncio
import csv
import logging
import sys
from typing import Any, Dict, List, Optional, Tuple, Union
@boronine
boronine / fetch_email.py
Created January 20, 2022 09:01
Fetch email from S3 bucket written to by SES "receive email" feature
#!/usr/bin/env python3
import os
import subprocess
import json
import glob
from pathlib import Path
RCLONE_REMOTE = 'my-s3-remote'
S3_BUCKET = 'my-ses-email-bucket'
RCLONE_REMOTE_S3 = f'{RCLONE_REMOTE}:{S3_BUCKET}'
rec {
pkgs = import <nixpkgs> {};
python3 = pkgs.python39.withPackages (ps: with ps; [ setuptools wheel twine ]);
v502 = pkgs.fetchzip {
url = "https://github.com/hsluv/hsluv-python/archive/refs/tags/v5.0.2.zip";
sha256 = "sha256-8uzDL8VWJmoH5Hnj+PZ3I1U1KdD5wyd/veM5LplHHGQ=";
};
v501 = pkgs.fetchzip {