Skip to content

Instantly share code, notes, and snippets.

View sharkdp's full-sized avatar

David Peter sharkdp

View GitHub Profile
#!/usr/bin/python
import argparse
import json
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser()
parser.add_argument("results", help="JSON file with benchmark results")
args = parser.parse_args()
#!/bin/bash
# the root directory for the search
base_path="$HOME" # CHANGE THIS
if ! which bench > /dev/null 2>&1; then
echo "'bench' does not seem to be installed."
echo "You can get it here: https://github.com/Gabriel439/bench"
exit 1
fi
#!/bin/bash
trap "tput reset; tput cnorm; exit" 2
clear
tput civis
lin=2
col=$(($(tput cols) / 2))
c=$((col-1))
color=0
tput setaf 2; tput bold
@sharkdp
sharkdp / cold-cache.sh
Last active October 7, 2017 20:13
fd benchmark scripts
echo "This script will now ask for your password in order to gain root/sudo"
echo "permissions. These are required to reset the harddisk caches."
echo ""
sudo echo "Okay, acquired superpowers :-)" || exit
base_path="/mnt/daten"
pattern='.*[0-9]\.jpg$'
for _ in $(seq 1 3); do
#pragma once
extern double pi;
@sharkdp
sharkdp / insect-type-safety.md
Last active August 24, 2017 19:59
Type-safety in physics calculations

Type-safety in physics calculations

This article describes a (loose?) analogy between physical units and data types in programming languages that I thought about while working on Insect, a scientific calculator that supports physical units.

In addition to typical mathematical operators like +, *, ^, %, etc., Insect has a special conversion operator (written as an arrow ->/ or as the word to). It can be used to convert an expression to a particular unit:

≫ 2 ft + 2 in ➞ cm

  = 66.04 cm
 
@sharkdp
sharkdp / watch.py
Created February 16, 2017 19:37
Randomly choose a movie from your IMDb watchlist
import csv
import random
with open("WATCHLIST.csv") as f:
rows = csv.DictReader(f, delimiter=",", quotechar='"')
movies = [row for row in rows if row["Title type"] == "Feature Film"]
movie = random.choice(movies)
@sharkdp
sharkdp / Main.purs
Last active February 12, 2017 16:31
Color matrix
module Main where
import Prelude
import Data.List.Lazy
import Data.Maybe
import Data.Tuple
import Data.Int (pow, toNumber)
import Flare
import Flare.Drawing
@sharkdp
sharkdp / Main.purs
Last active September 10, 2017 08:44
Try Flare main example
module Main where
import Prelude
import Text.Smolder.HTML as H
import Text.Smolder.Markup ((!), text)
import Text.Smolder.HTML.Attributes as A
import Color (black, toHexString)
import Flare.Smolder (runFlareHTML)
Data.NaturalTransformation
Type.Proxy
Data.Boolean
Unsafe.Coerce
Data.Int.Bits
Data.Show
Data.String.Unsafe
Global.Unsafe
Data.ArrayBuffer.Types
Data.Char