Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am LeszekSwirski on github.
  • I am leszek (https://keybase.io/leszek) on keybase.
  • I have a public key whose fingerprint is 8D0F A0C7 EA5D E958 7DC0 5C99 009D 7286 D20B 319A

To claim this, I am signing this object:

#include <iostream>
#include <string>
#include <vector>
#include <memory>
#include <sstream>
#include <cassert>
struct ArgumentBase {
explicit ArgumentBase(std::string name) : name(std::move(name)), is_set(false), _has_default(false), _has_implicit(false), _use_implicit(false) {
}
@LeszekSwirski
LeszekSwirski / pinknoise.ipynb
Last active August 29, 2015 14:09
Create pink noise
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import mlab
def one_over_f(f, knee, alpha):
desc = np.ones_like(f)
desc[f<KNEE] = np.abs((f[f<KNEE]/KNEE)**(-alpha))
desc[0] = 1
return desc
@LeszekSwirski
LeszekSwirski / via-ssh.sh
Last active August 29, 2015 14:08 — forked from vitex/via-ssh.sh
#!/bin/sh
########################################################################
#
# Usage: via-ssh.sh [-v] [-d] [USER@]SERVER[:PORT]
#
# -v Provide verbose output.
# -d Send all UDP on the DNS port 53 to 127.0.0.1.
# USER User name to use for SSH; default is current user.
# SERVER Server to use for SSH.
@LeszekSwirski
LeszekSwirski / inout.cpp
Last active March 25, 2020 06:48
C++ out/inout parameters
#include <algorithm>
template <typename T>
class out_ {
public:
explicit out_(T& val) : pval(&val) {}
explicit out_() : pval(nullptr) {}
void operator=(const T& newval) {
if (pval) {