Skip to content

Instantly share code, notes, and snippets.

Rust 101

$whoami

@rhapsodhy

Startupok Rust + Security

@rsdy
rsdy / keybase.md
Created June 16, 2017 17:49
keybase.md

Keybase proof

I hereby claim:

  • I am rsdy on github.
  • I am rsdy (https://keybase.io/rsdy) on keybase.
  • I have a public key ASCcTI_WQcB3IWuz-KfgWsTaUnfmb2o8qJm_t-hvcbEEUAo

To claim this, I am signing this object:

@rsdy
rsdy / Dockerfile
Created March 29, 2017 09:07
Rust musl builder container
FROM ubuntu:16.04
RUN apt-get update && \
apt-get upgrade -y && \
apt-get -y install curl build-essential cmake libssl-dev xutils-dev musl-tools && \
ln -s /usr/bin/g++ /usr/bin/musl-g++ && \
useradd build && \
mkdir -p /home/build && \
chown -R build:build /home/build
@rsdy
rsdy / acbuild.sh
Created July 9, 2016 22:32
Script stub for generating ACIs on debian testing
acbuild begin
acbuildEnd() {
export EXIT=$?
acbuild --debug end && exit $EXIT
}
trap acbuildEnd EXIT
echo $(dd if=/dev/urandom bs=1b count=512 |sha256sum |head -c32) >rkt-machine-id
acbuild set-name random.com/alpine-tmux
@rsdy
rsdy / i3-stop
Created September 14, 2015 01:05
Stops a process by name if switched away from workspace
#!/usr/bin/env python3
import i3ipc
from sh import pkill
WNAME='browser'
PNAME='firefox'
def on_workspace(i3, e):
if e.current.props.name == WNAME:
@rsdy
rsdy / sudoers
Created March 10, 2014 18:51
invoke yaourt as a dedicated user with sudo rights
# append to /etc/sudoers
#
yaourt ALL=(root) NOPASSWD: /usr/bin/pacman, /usr/bin/pacdiffviewer
@rsdy
rsdy / Makefile
Created December 3, 2013 08:44
Pdflatex livecoding with tmux
do:
pandoc -f markdown -t latex plan.md > sections.tex
pdflatex plan.tex
pdflatex plan.tex
live:
while inotifywait plan.md; do \
make do; \
done
@rsdy
rsdy / tarsnap-backup.sh
Last active December 14, 2015 04:19
simple backup script wrapping tarsnap
#!/bin/ksh
#
# compile tarsnap, and install it to $BASEDIR
#
# put the files/dirs to be included into $BASEDIR/includes
# specify exclude patterns in $BASEDIR/excludes
# both files should contain either space or newline-separated items
#
# tweak $DELETE_ARCH to specify the retention time after which the
# archives will be deleted
@rsdy
rsdy / output
Last active December 13, 2015 22:59
haskell zipwith vs. map-zip
warming up
estimating clock resolution...
mean is 1.363583 us (640001 iterations)
found 3371 outliers among 639999 samples (0.5%)
2926 (0.5%) high severe
estimating cost of a clock call...
mean is 38.34752 ns (12 iterations)
found 1 outliers among 12 samples (8.3%)
1 (8.3%) low severe
@rsdy
rsdy / e
Last active December 12, 2015 01:19
open the file in emacs and switch to the emacs workspace at the same time
#!/bin/sh
# ~/bin/e
emacsclient --alternate-editor="emacs" -n "$@" 2>/dev/null & disown
# 4 is the number of the virtual desktop where emacs resides
# the wm should spawn a new instance there automagically
wmctrl -s 4