Skip to content

Instantly share code, notes, and snippets.

View hirschenberger's full-sized avatar

Falco Hirschenberger hirschenberger

  • Kaiserslautern, Germany
View GitHub Profile
@hirschenberger
hirschenberger / gruvbox.html
Created September 20, 2022 10:27
Helix gruvbox theme preview
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- This file was created with the aha Ansi HTML Adapter. https://github.com/theZiz/aha -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xml+xhtml; charset=UTF-8"/>
<title>/tmp/115f219</title>
</head>
<body>
<pre>
@hirschenberger
hirschenberger / binsearch.ll
Created April 26, 2017 15:03
Binsearch benchmark LLVM-IR and ASM
; ModuleID = 'binsearch_bench.cgu-0.rs'
source_filename = "binsearch_bench.cgu-0.rs"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%str_slice = type { i8*, i64 }
%"test::Bencher" = type { %"core::option::Option<test::stats::Summary>", [0 x i8], i64, [0 x i8], i8, [7 x i8] }
%"core::option::Option<test::stats::Summary>" = type { i64, [0 x i64], [14 x i64] }
%closure = type { %"collections::vec::Vec<usize>"*, [0 x i8] }
%"collections::vec::Vec<usize>" = type { %"alloc::raw_vec::RawVec<usize>", [0 x i8], i64, [0 x i8] }
@hirschenberger
hirschenberger / slice.rs
Created April 21, 2017 14:19
Strange Rust heapsort performance difference
#![feature(test, rand)]
extern crate test;
extern crate rand;
use test::Bencher;
use rand::{Rng, XorShiftRng};
pub fn heapsort_new<T, F>(v: &mut [T], is_less: &mut F)
where F: FnMut(&T, &T) -> bool
{
// This binary heap respects the invariant `parent >= child`.
#![feature(test)]
#![feature(core_intrinsics)]
extern crate test;
use test::Bencher;
use std::cmp;
use std::cmp::Ordering;
use std::intrinsics;
fn binary_search(ss: &[usize], search: usize) -> Result<usize, usize>
{
pub struct K8055<'a> {
ctx: usb::Context,
dev: usb::Device<'a>,
hd: Option<usb::DeviceHandle<'a>>,
state: State
}
impl<'a> K8055<'a> {
/// Create a new K8055 instance with the first card found on the system.
///
@hirschenberger
hirschenberger / map.txt
Created April 23, 2014 15:28
Rusty Wireworld
##
+@############# #################
##
@hirschenberger
hirschenberger / histogram.hs
Created November 15, 2012 15:31
Repa histogram benchmark
{-# LANGUAGE FlexibleInstances #-}
import Codec.Picture.Repa
import qualified Data.Array.Repa as R
import qualified Data.Array.Repa.Unsafe as RU
import qualified Data.Vector.Unboxed as VU
import Data.Array.Repa.Repr.ForeignPtr (F)
import Data.Array.Repa ((:.), Array, (:.)(..), Z(..), DIM3)
import System.Environment
import Data.Word
import Criterion.Main
@hirschenberger
hirschenberger / gist:2875296
Created June 5, 2012 14:20
Original Shootout code in Erlang
-module(mandelbrot).
-export([main/1]).
-define(LIM_SQR, 4.0).
-define(ITER, 50).
-define(SR, -1.5).
-define(SI, -1).
main([Arg]) ->
N = list_to_integer(Arg),
io:put_chars(["P4\n", Arg, " ", Arg, "\n"]),
@hirschenberger
hirschenberger / gist:2875286
Created June 5, 2012 14:18
Mandelbrot Shootout code in Elixir
defmodule Mandelbrot do
defmacrop lim_sqr do 4.0 end
defmacrop iter do 50 end
defmacrop sr do -1.5 end
defmacrop si do -1 end
def main do
n = 16000
IO.write('P4\n#{n} #{n}\n')
row = fn(y) -> Process.spawn(fn() -> row(0, si()+y*2/n, n, 0, [], 7) end) end
@hirschenberger
hirschenberger / gist:1109668
Created July 27, 2011 15:55
Image polar transformation in Haskell with repa
module Main where
import Data.Array.Repa
import Data.Array.Repa.IO.DevIL
import Data.Word
import Directory
import Control.Monad.IO.Class
expTable:: Int -> Double -> [Double]
expTable sx m = [exp(fromIntegral i / m) | i <- [0..sx]]