Skip to content

Instantly share code, notes, and snippets.

View dzfranklin's full-sized avatar

Daniel Franklin dzfranklin

  • Dundee, UK
  • 08:38 (UTC +01:00)
View GitHub Profile
Jun 05 01:44:40 geder gnome-shell[6176]: Removing a network device that was not added
Jun 05 01:44:40 geder gnome-shell[6176]: Removing a network device that was not added
Jun 05 01:44:40 geder gnome-shell[6176]: Removing a network device that was not added
Jun 05 01:45:40 geder gnome-shell[6176]: Removing a network device that was not added
Jun 05 01:45:40 geder gnome-shell[6176]: Removing a network device that was not added
Jun 05 01:45:40 geder gnome-shell[6176]: Removing a network device that was not added
Jun 05 01:46:40 geder gnome-shell[6176]: Removing a network device that was not added
Jun 05 01:46:41 geder gnome-shell[6176]: Removing a network device that was not added
Jun 05 01:46:41 geder gnome-shell[6176]: Removing a network device that was not added
Jun 05 01:47:41 geder gnome-shell[6176]: Removing a network device that was not added
@dzfranklin
dzfranklin / gist:abbd3028589de0abe8dc51b5757c4ea6
Created March 30, 2023 10:45
Output of cargo test -- --list
0 tests, 0 benchmarks
encoding_any_prop: test
encoding_prop: test
2 tests, 0 benchmarks
test::json_any_array: test
test::json_any_bool: test
test::json_any_map: test
test::json_any_null: test
test::json_any_number: test
defp clear_record_id_error(changeset) do
errors =
changeset.errors
|> Enum.filter(fn
{:record_id, _} -> false
_ -> true
end)
if Enum.empty?(errors) do
%{changeset | errors: [], valid?: true}
defmodule Wrench.Hex.Api.Requester do
use GenServer
require Logger
@config Application.get_env(:wrench, __MODULE__)
@api_key @config[:api_key]
@ua "Wrench/#{Application.spec(:wrench, :vsn)} (contact #{Application.get_env(:wrench, :operator_contact)})"
@endpoint "https://hex.pm/api"
def start_link(opts) do
package com.backpackingmap.backpackingmap.ui.view
import androidx.compose.foundation.background
import androidx.compose.foundation.interaction.FocusInteraction
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.PressInteraction
import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
private class SectionsAnimationState constructor(
initialPosition: PagePosition,
private val renderer: Renderer,
private val onPosition: (PaginatedTextPosition) -> Unit,
) {
private val _positionBacking = mutableStateOf(initialPosition)
private var lastPageReportedToOnPosition = initialPosition.page.roundToInt()
private var _position
get() = _positionBacking.value
set(value) {
@dzfranklin
dzfranklin / stderr.txt
Created May 6, 2021 16:45
Full output of `cargo build` of lldb-sys
Compiling lldb-sys v0.0.20 (/home/daniel/lldb-sys.rs)
The following warnings were emitted during compilation:
warning: src/lldb/Bindings/SBCommandInterpreterBinding.cpp: In function ‘SBCommandInterpreterRunOptionsOpaque* CreateSBCommandInterpreterRunOptions()’:
warning: src/lldb/Bindings/SBCommandInterpreterBinding.cpp:22:99: error: invalid use of incomplete type ‘class lldb::SBCommandInterpreterRunOptions’
warning: 22 | return reinterpret_cast<SBCommandInterpreterRunOptionsRef>(new SBCommandInterpreterRunOptions());
warning: | ^
warning: In file included from /usr/lib/llvm-11/include/lldb/API/SBBreakpoint.h:12,
warning: from src/lldb/Bindings/SBBreakpointBinding.h:15,
warning: from src/lldb/Bindings/LLDBBinding.h:21,
Edit: TLDR: If you need to talk to a library that's very hard to write a completely sound abstraction for, consider writing a mostly sound one (with a clear disclaimer) instead of switching to a different language. Obviously this would be stupid if your code operates on untrusted inputs, but plenty of stuff doesn't. I'm writing code that takes input from your kernel.
I've been thinking recently about various articles by people who have given up on Rust projects, such as [the Way Cooler post mortem](http://way-cooler.org/blog/2020/01/09/way-cooler-post-mortem.html). I think one of the problems is that people sometimes feel it's "wrong" to write unsound code in Rust, so they give up or switch to another language, write unsound code in that language, and feel better about it. By unsound I mean unsafe code that is undefined behavior, i.e. violates the memory safety model of rust.
I find it interesting that I'm my experience people newer to writing unsafe Rust tend to see soundness in binary terms, whereas at l
use ring::digest::{Algorithm, Context, Digest};
use std::{fmt, io};
pub struct WithDigest<W> {
inner: W,
ctx: Context,
}
impl<W> WithDigest<W> {
pub fn new(algorithm: &'static Algorithm, inner: W) -> Self {
@dzfranklin
dzfranklin / with_tracing_subscriber.png
Last active April 20, 2021 21:13
tracing-subscriber interferes with debugger
with_tracing_subscriber.png