Skip to content

Instantly share code, notes, and snippets.

diff --git a/scripts/patch.py b/scripts/patch.py
index 62dd248b..e4b7da1f 100755
--- a/scripts/patch.py
+++ b/scripts/patch.py
@@ -29,6 +29,10 @@ def parse_args():
type=boolean_string, nargs='?',
default=False, const=True,
help="dry run")
+ parser.add_argument('--remove',
+ type=boolean_string, nargs='?',
namespace gin {
namespace detail {
// Get a key from `key_val` and check `lookup` for a matching entry.
// Return true iff a match is found, and set `*out` to the entry's value.
template <typename KeyType, typename Out, typename Map>
bool FromV8WithLookup(
v8::Isolate* isolate,
v8::Local<v8::Value> key_val,
#!/usr/bin/zsh
# Simple script to run a png through a pipeline of lossless png compressors
# to find the smallest output from all of them.
#
# The goal is the smallest losslessly-compressed file, so excessive switches
# are used, e.g. `advpng --shrink-insane`. This is computationally expensive.
#
# To run this on a file:
# $ pngmin.zsh filename.png
diff --git a/libtransmission/announcer-udp.cc b/libtransmission/announcer-udp.cc
index e8c178883..5a5979c45 100644
--- a/libtransmission/announcer-udp.cc
+++ b/libtransmission/announcer-udp.cc
@@ -304,6 +304,7 @@ struct tau_tracker
TR_ASSERT(addr_);
if (!addr_)
{
+ fmt::print("can't send request; no address yet\n");
return;
// This file Copyright © 2007-2022 Mnemosyne LLC.
// It may be used under GPLv2 (SPDX: GPL-2.0), GPLv3 (SPDX: GPL-3.0),
// or any future license endorsed by Mnemosyne LLC.
// License text can be found in the licenses/ folder.
#ifndef TR_CRYPTO_UTILS_H
#define TR_CRYPTO_UTILS_H
#include <algorithm>
#include <array>
@ckerr
ckerr / fmt + pot notes
Last active March 20, 2022 22:26
finding source of 'argument not found' error with fmt::format
If fmt is throwing an exception, the breakpoint to set is:
`fmt::v8::detail::throw_format_error`
Finding the current parameters:
```sh
rg --no-filename 'fmt::arg' libtransmission gtk daemon utils | sed "s/^.*fmt::arg(\(.*\)\,.*$/\1/" | cut -f2 -d'"' | sort | uniq
```
#!/usr/bin/env bash
# This folds the Qt, GTK, utils, and libtransmission strings all into a single potfile
# for ease of finding similar or conflicting strings that can be unified.
#
# TODO: would it make sense to submit a single potfile to translators, then massage
# their translations to make per-client translation files? Even though there are
# superficial differences that prevent some unification (e.g. Qt accelerators "&Open"
# GTK accelerators "_Open") it might be *conceptually* similar to translators when they
# see the similar strings next to each other?
#!/usr/bin/env bash
# --slave /usr/bin/$1 $1 /usr/bin/$1-\${version} \\
function register_clang_version {
local version=$1
local priority=$2
update-alternatives \
--install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${version} ${priority} \
@ckerr
ckerr / gist:b5313021e52b3060f8b678152f177095
Created September 14, 2021 00:03
gcc 5.5-friendly way of including optional
#if !defined(__has_include) || __has_include(<optional>)
#include <optional>
#elif __has_include(<experimental/optional>)
#include <experimental/optional>
namespace std { template<typename T> using optional = experimental::optional<T>; }
#endif
console.log('hello world!');