Skip to content

Instantly share code, notes, and snippets.

View TethysSvensson's full-sized avatar

Tethys Svensson TethysSvensson

  • Copenhagen, Denmark
View GitHub Profile
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 { ... }

Keybase proof

I hereby claim:

  • I am idolfhatler 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:

fn foo(n: &u64) -> proc() -> u64 {
proc() { *n }
}
fn mk_foo(n: u64) -> proc() -> u64 {
foo(&n)
}
fn main() {
let x = mk_foo(1);
#![feature(macro_rules)]
use std::cell::{RefCell, Ref};
use std::rc::Rc;
pub struct Thunk<T>(Rc<RefCell<ThunkValue<T>>>);
pub enum ThunkValue<T> {
Eager(T),
Lazy(proc() -> T)
}
struct Foo(u8);
type Bar = Foo;
impl Bar {}
fn main() {}
/*
bug2.rs:3:1: 3:12 error: cannot associate methods with a type outside the crate the type is defined in; define and implement a trait or new type instead
bug2.rs:3 impl Bar {}
^~~~~~~~~~~
error: aborting due to previous error
#!/usr/bin/env python
from pwn import *
import time, sys
context('linux')
# Our polyglots to branch our for a single architecture
# ARMEL: b $ + 464
# ARMEB: andvc r0, r0, #234
from pwn import *
import pwn2
import sys
HELLO = 0
READY = 1
ERROR = 255
REQ_POST = 11
RESP_POST = 12