Skip to content

Instantly share code, notes, and snippets.

@jpetazzo
jpetazzo / ansibull.png
Created August 27, 2015 22:53
Generate an ANSI bull.
ansibull.png
So this is on my "puny" i7, which is a "Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz".
During the bench I think it was running at 2 GHz, and it's supposed to be able to boost at 3.3 GHz.
(But I hard-capped the speed because I don't like when my laptop starts to levitate because of fanspeed ;-))
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
md2 0.00 0.00 0.00 0.00 0.00
mdc2 0.00 0.00 0.00 0.00 0.00
md4 21071.83k 63368.19k 147767.22k 221280.60k 258719.74k
@jpetazzo
jpetazzo / README.md
Last active August 29, 2015 14:01
BTRFS, schmetterFS

First, we need recent btrfs tools. Otherwise, we're entering a world of pain.

So:

apt-get build-dep btrfs-tools
apt-get install liblzo2-dev libblkid-dev
git clone git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git
make -j -C btrfs-progs
#!/bin/sh
sudo sh -c 'for CPU in /sys/devices/system/cpu/cpu[0-9]* ; do echo powersave > $CPU/cpufreq/scaling_governor ; done'
sudo sh -c 'for CPU in /sys/devices/system/cpu/cpu[0-9]* ; do echo 800000 > $CPU/cpufreq/scaling_min_freq ; done'
sudo sh -c 'for CPU in /sys/devices/system/cpu/cpu[0-9]* ; do echo 2000000 > $CPU/cpufreq/scaling_setspeed ; done'
sudo sh -c 'for CPU in /sys/devices/system/cpu/cpu[0-9]* ; do echo 2000000 > $CPU/cpufreq/scaling_max_freq ; done'
@jpetazzo
jpetazzo / README.md
Created July 3, 2014 12:14
Shared Mounts Experiment
FROM ubuntu
ADD run.sh /
CMD bash
@jpetazzo
jpetazzo / README.md
Created August 4, 2014 16:48
BASE27 encoding

Base 27 encoding

This is just for lulz.

  • Take a character string (ASCII8, no character >242).
  • Transform each byte into a sequence of 5 trinary digits (i.e. from 00000 to 22222).
  • Concatenate all trinary digits (i.e. a long sequence of 0, 1, and 2).
  • Add extra 0s at the end so that the total length is divisible by 3.
  • Break down by groups of 3.
  • Transform each group of 3 into an integer, ranging from 0 to 26.
#!/bin/sh
exec docker run -t \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /:/hostfs -w /hostfs/$(pwd) \
fig fig "$@"
  1. Start container
  2. Create view.sh
  3. Create a FIFO with mkfifo /tmp/view
  4. Have a writer on the FIFO: just leave cat >/tmp/view running somewhere
  5. Run socat TCP-LISTEN:8080,reuseaddr,fork EXEC:/path/to/view.sh
  6. Whenever you want to kick everybody out, you can kill socat or kill the cat process :-)
FROM ubuntu:14.04
RUN apt-get update -q
RUN apt-get install -qy chromium-chromedriver
RUN apt-get install -qy python3-pip
RUN apt-get install -qy xvfb
RUN apt-get install -qy x11vnc
RUN pip3 install IPython
RUN pip3 install selenium
RUN pip3 install PyYAML
RUN touch /credentials.yml