Skip to content

Instantly share code, notes, and snippets.

View 46bit's full-sized avatar
🏳️‍🌈

Miki Mokrysz 46bit

🏳️‍🌈
View GitHub Profile
@drahamim
drahamim / questions.txt
Created October 13, 2021 20:24
Job Questions for recruiters
Hi {{ Recruiter_first_name }},
Thanks for reaching out. Before we jump on a call, can you answer a few questions for me.
1. What is the current on-call like for the team?
2. How much on-call is expected for this role?
3. Expected Base comp range?
4. What are the expected {{ your_tz }} work hours?
5. How big is the team?
Please also send over a FULL job description.
Thanks in advance,
{{ Your First name here }}
@philandstuff
philandstuff / devopsdays.org
Last active October 12, 2017 21:05
Devopsdays london 2017

Devopsdays London 2017

initial session, bob walker (@rjw1)

  • welcome everyone!
  • we have a code of conduct
  • thanks to organisers, sponsors, etc

Humane Teams at home and around the world

@chrishanretty
chrishanretty / conswing.R
Last active April 24, 2017 20:45
Analysis of swings in Conservative and Labour-held seats, BES data
library(foreign) ## for data import
library(dplyr) ## for chaining ops together
library(ggplot2) ## for plotting
library(reshape2) ## for reshaping
library(hrbrthemes) ## for pretty pictures
library(survey) ## for... uh, survey data
party.colours <- c("#0087DC","#D50000","#FDBB30","#FFFF00","#008142","#99CC33","#70147A","#DDDDDD")
bes <- read.spss("~/Dropbox/2017-forecasting/data/individual/BES2015_W10_Panel_v0.3.sav")
@robey
robey / simplified-future.md
Last active April 10, 2017 20:00
Changing the shape of rust Future & Stream

Changing the shape of rust Future & Stream

On the tokio chat, @carllerche suggested that one way to simplify the "errors on streams" problem (rust-lang/futures-rs#206) would be to remove the error alternative from Future & Stream. This idea stuck with me, and I want to sketch out a possible alternative, to see how it would look.

Currently

  • Future<Item, Error>: A future resolves to either an item or an error type, exactly like an async version of Result.
    • poll() -> Poll<Item, Error>: not ready, or an item, or an error
  • Stream<Item, Error>: A stream emits elements that are each either an item or error, exactly like an async iterable of Result.
    • poll() -> Poll<Option<Item>, Error>: not ready, or the end of the stream (Ready(None)), or an item, or an error
@silvadanilo
silvadanilo / infinite-reconnect.rs
Last active May 16, 2019 09:03
Asynchronously reconnecting a client to a server in an infinite loop
extern crate futures;
extern crate tokio_core;
extern crate tokio_line;
use futures::future::{self, Future, Loop};
use futures::{Stream};
use std::{io, str};
use tokio_core::io::{Io};
use tokio_core::net::{TcpStream};
use tokio_core::reactor::{Core, Handle};
extern crate futures;
use std::sync::atomic::{AtomicBool, Ordering};
use std::thread;
use std::sync::Arc;
use std::time::{Instant, Duration};
use futures::{Async, Future};
use futures::executor::{self, Spawn};
use futures::task::Unpark;
@46bit
46bit / lfsr.py
Created November 2, 2016 00:27
Tests need Python 3.4 or greater (for `unittest.TestCase.subTest`).
import operator
import functools
import unittest
import random
class LFSR():
def __init__(self, width, taps=None, seed=1):
if width < 1:
raise ValueError("Requested LFSR width < 1.")
@Sgeo
Sgeo / gadts.rs
Last active July 14, 2023 12:14 — forked from mstewartgallus/gadts.rs
Gadts in Rust
/// This type is only every inhabited when S is nominally equivalent to T
#[derive(Debug)]
pub struct Is<S, T>(::std::marker::PhantomData<(*const S, *const T)>);
// Construct a proof of the fact that a type is nominally equivalent
// to itself.
pub fn is<T>() -> Is<T, T> { Is(::std::marker::PhantomData) }
// std::mem::transmute does not accept unsubstituted type parameters
// manual transmute as suggested by manual
@14427
14427 / hkt.rs
Last active February 7, 2024 10:18
Higher-kinded type trait
use std::rc::Rc;
trait HKT<U> {
type C; // Current type
type T; // Type with C swapped with U
}
macro_rules! derive_hkt {
($t:ident) => {
impl<T, U> HKT<U> for $t<T> {
@46bit
46bit / alphac.py
Last active August 29, 2015 14:13
ALPHAC text encrypter that I'm attacking for fun, reimplemented cleanly in Python. Source: http://www.myersdaily.org/joseph/javascript/alphac.html.
from random import randint
# ALPHAC encryption method
# From http://www.myersdaily.org/joseph/javascript/alphac.html
# This a much cleaner Python reimplementation for Cryptanalysis.
class Alphac:
c64 = list("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
# s = input string (only characters in c64)
# k = key string (only characters in c64)