Skip to content

Instantly share code, notes, and snippets.

@fffergal
fffergal / gih_wait_repo_status
Created December 15, 2023 11:59
A little script to send you a notification when the main branch build finishes.
#!/usr/bin/env bash
set -euo pipefail
repo="$(gh repo view --json nameWithOwner | jq -r .nameWithOwner)"
default_branch="$(gh repo view --json defaultBranchRef | jq -r .defaultBranchRef.name)"
status="$(gh api "/repos/$repo/commits/$default_branch/status" --jq '.state')"
while [[ "$status" = "pending" ]] ; do
sleep 60
status="$(gh api "/repos/$repo/commits/$default_branch/status" --jq '.state')"
done
import SwiftUI
import CoreData
struct ContentView: View {
@Environment(\.managedObjectContext) private var viewContext
@State var progressValue: Double = 1
var body: some View {
NavigationView {
List {
class NoCronChildrenTracer(trace_sdk.Tracer):
'''
Custom Tracer that breaks the parent relationship for cron tasks.
This is so we can use a parent based sampler without excluding or including a whole
cron run. Otherwise we would see one whole run a day with a 1/100 sampling rate. If
the cron isn't the parent, we can sample its children by trace ID, and preserve the
whole trace with descendant spans.
This will also have the benfit of making the UI easier to use, as query results

Keybase proof

I hereby claim:

  • I am fffergal on github.
  • I am fffergal (https://keybase.io/fffergal) on keybase.
  • I have a public key ASAA7leQvmFXAl9hnZjzEX-NdIbPYchPJ-bWvO9a5BRGego

To claim this, I am signing this object:

<mxfile userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.1 Safari/605.1.15" version="9.0.2" editor="www.draw.io" type="device"><diagram id="59408993-a5ff-980a-bbfb-0dfc10982780" name="Page-1">7V1rc6M4Fv01rtrZqqR4gz/m0T2Tms5UqpOtnfmUUoxis8HIDUonnl+/Eki8JGwcC/BuNNVVAwIM3HN177lHSJnZV+v3X1OwWd2iEMYzywjfZ/b1zLKsYO6T/9GWLWux6S5tWaZRWLSZVcN99DdkjQZrfY1CmDVOxAjFONo0GxcoSeACN9pAmqK35mnPKG7edQOWUGi4X4BYbP13FOJV0RpYftX+G4yWK35n05sXR57A4mWZoteE3W9m2c/5f8XhNeC/xV40W4EQvdWa7C8z+ypFCBdb6/crGFPjcrMV133tOFo+dwoT3OcCBstPEL+yV1/DJXjE4ImYwvLI47+DmX3JHhZvuYGyt2gdg4TsXT6jBN+zIwbZX6yiOPwGtuiVPkGGiUX43uUKpdHf5HwQk0MmaSCHU8zwJ7cjvxbF8RWKUUoaEpTfoLronv4Yu00KM3LZHX9Ts9V0C94bJ34DGeYPiOIYbLLoKX9keuEapMsouUQYozU7ib/g19rzVGByi9QNzWz/E6YYvteamOF/hWgNcbolp7CjPncC1kvOLId50Vvlc2bATlrV/c1njYD5+bL88QprssHglkNvC9DPrEvaWSJIe8sF2ZxdWbMLA2CcRk+vOELJ73AruAJ5W5wjmaIX2IJOgiaIo2VCdmP4TC+j5opIx7tgzRht6I9twCJKlt/yc66dquU7MwJtQuTa5zjvPasoDGFCwUYYFM5bwLhBUYJzI7mX5B8x25Vx7s5c8uBXZN+s9sk/enqKr1BC
--- old.cfg 2018-03-25 00:57:52.000000000 +0000
+++ new.cfg 2018-03-25 00:57:35.000000000 +0000
@@ -1,551 +1,187 @@
-[MASTER]
-
-# A comma-separated list of package or module names from where C extensions may
-# be loaded. Extensions are loading into the active Python interpreter and may
-# run arbitrary code
-extension-pkg-whitelist=
-
# With 100 classes
In [34]: things = {i: list(type('hey', (object,), {})() for j in range(10)) for i in range(10
...: )}
In [35]: %%timeit -o the_type = type(choice(list(instance for key, instances in things.items(
...: ) for instance in instances)))
...: any(the_type is type(instance) for key, instances in things.items() for instance in
...: instances)
The slowest run took 16.05 times longer than the fastest. This could mean that an intermediate result is being cached.
9.32 µs ± 5.88 µs per loop (mean ± std. dev. of 7 runs, 100000 loops each)
@fffergal
fffergal / gist:784a1569dc71b10e76a245e7155c9768
Created July 14, 2017 16:11
"write good" Drafts app action URL
x-drafts4://x-callback-url/import_action?v=2&tintColor=%5B%0A%0A%5D&shouldConfirm=0&logLevel=1&uuid=89A3A285-224F-4317-B1B2-D4BB48AEB6AF&disposition=3&actionSteps=%5B%0A%20%20%7B%0A%20%20%20%20%22scriptText%22%20%3A%20%22%5C%2F%2A%5CnBased%20on%20a%20webpacked%20version%20of%20https%3A%5C%2F%5C%2Fgithub.com%5C%2Fbtford%5C%2Fwrite-good.%5Cn%5Cn%5CnLicense%20for%20this%20Draft%20app%20action%3A%5CnCopyright%202017%20Fergal%20Hainey%5Cn%5CnLicensed%20under%20the%20Apache%20License%2C%20Version%202.0%20%28the%20%5C%22License%5C%22%29%3B%5Cnyou%20may%20not%20use%20this%20file%20except%20in%20compliance%20with%20the%20License.%5CnYou%20may%20obtain%20a%20copy%20of%20the%20License%20at%5Cn%5Cn%20%20%20%20http%3A%5C%2F%5C%2Fwww.apache.org%5C%2Flicenses%5C%2FLICENSE-2.0%5Cn%5CnUnless%20required%20by%20applicable%20law%20or%20agreed%20to%20in%20writing%2C%20software%5Cndistributed%20under%20the%20License%20is%20distributed%20on%20an%20%5C%22AS%20IS%5C%22%20BASIS%2C%5CnWITHOUT%20WARRANTIES%20OR%20CONDITIONS%20OF%20ANY%2
@font-face {
font-family: 'PragmataPro Mono';
font-weight: normal;
font-style: normal;
src: local('PragmataPro Mono');
}
@fffergal
fffergal / solarised-dark-magenta-cursor.js
Last active May 19, 2020 13:33
Solarized Dark theme for Blink with a magenta cursor
base03 = "#002b36";
base02 = "#073642";
base01 = "#586e75";
base00 = "#657b83";
base0 = "#839496";
base1 = "#93a1a1";
base2 = "#eee8d5";
base3 = "#fdf6e3";
yellow = "#b58900";
orange = "#cb4b16";