Skip to content

Instantly share code, notes, and snippets.

View TethysSvensson's full-sized avatar

Tethys Svensson TethysSvensson

  • Copenhagen, Denmark
View GitHub Profile
{ pkgs, writeScriptBin, hacksaw, shotgun, xclip }:
writeScriptBin "screenshot" ''
#!${pkgs.bash}/bin/sh
set -e
file=$(date +/tmp/screenshot-%F-%H%M%S.png)
if [[ "$1" = "full" ]]; then
${shotgun}/bin/shotgun $file
#[derive(Copy, Clone)]
enum LinkedList<'a> {
Nil,
Cons(u8, &'a LinkedList<'a>),
}
struct LinkedListIter<'a> {
list: LinkedList<'a>,
}

Keybase proof

I hereby claim:

  • I am tethyssvensson on github.
  • I am idolfhatler (https://keybase.io/idolfhatler) on keybase.
  • I have a public key ASA_aryPlRjMh1wwOTLM6sgIjvlyeyx6iPPZg75T7JZkIwo

To claim this, I am signing this object:

use flatbuffers::{Vector, Follow};
fn first<'a, T: Follow<'a> + 'a>(v: Vector<'a, T>) -> Option<T::Inner> {
if v.len() > 0 {
Some(v.get(0))
} else {
None
}
}
module Test where
open import Function using (id ; _∘_)
open import Relation.Binary.PropositionalEquality using (_≡_ ; refl)
open import Data.Maybe
record RawFunctor (F : Set Set) : Set₁ where
field
fmap : {A B} (A B) F A F B
module Test where
open import Function using (id ; _∘_)
open import Relation.Binary.PropositionalEquality using (_≡_ ; refl)
record RawFunctor (F : Set Set) : Set₁ where
field
fmap : {A B} (A B) F A F B
open RawFunctor {{...}} public
use std::ops::Add;
trait X<Rhs, Output>
where Self: Add<Rhs, Output = Output>,
Self: for<'rhs> Add<&'rhs Rhs, Output = Output>
{}
// First try, does not work
trait Y1 { fn foo(&self); }
trait Z1: Sized
import random
def mymul(a, b):
if a > b:
a, b = b, a
res = 0
for n in range(a.bit_length()):
if a & (1 << n):
res ^= b << n

Keybase proof

I hereby claim:

  • I am idolf on github.
  • I am idolfhatler (https://keybase.io/idolfhatler) on keybase.
  • I have a public key whose fingerprint is DC7B EEB0 8175 E641 6BB1 7901 E76B 7B2D 2F2F F530

To claim this, I am signing this object:

pub type PyPtr = *mut PyObjectHead;
#[repr(C)]
pub struct PyRef(PyPtr);
extern "C" fn say_hello(selfval: PyPtr, args: PyPtr) -> PyPtr { ... }
extern "C" fn say_hello(selfval: PyRef, args: PyRef) -> PyRef { ... }