Skip to content

Instantly share code, notes, and snippets.

View hdorio's full-sized avatar
🙂
Have a nice day

Hadrien Dorio hdorio

🙂
Have a nice day
View GitHub Profile

Zig build steps

sequenceDiagram

participant files as Files
participant cc as C compiler
participant wasm2c as wasm2c
participant zig1 as zig1
participant zig2 as zig2
@hdorio
hdorio / diff.sh
Last active January 13, 2022 06:51
number of lines
python -c "print($(grep -v "}\$" fast.zig | wc -l) - $(grep -v "}\$" small.zig | wc -l))"
// 259
@hdorio
hdorio / decompress.zig
Last active January 11, 2022 10:05
decompress.zig
// outputs
//
// deflate_old: 3.982s
// deflate_new: 2.08s
//
// deflate_old: 3.852s
// deflate_new: 2.075s
//
// deflate_old: 3.895s
// deflate_new: 2.044s
const std = @import("std");
// Tested on Ubuntu 20.04.3 LTS x86_64 GNU/Linux
// `ulimit -s` => 8192
pub fn main() void {
// var big: [16_384 * 1_023]u8 = undefined; // works
var big: [16_384 * 1_024]u8 = undefined; // Segmentation fault
_ = big;
std.debug.print("aybabtu\n", .{});
}
# Install libgit2
# sudo apt install libgit2-dev # this is v0.28 but we need v1.0
# Build libgit2
sudo apt install libssl-dev
git clone https://github.com/libgit2/libgit2.git
cd libgit2
mkdir build && cd build
cmake ..
cmake --build . --target install
@hdorio
hdorio / Zig-install-on-ubuntu-20.04.md
Created October 19, 2020 15:10
Installation instructions to build Zig on Ubuntu 20.04

These instructions assert a clean install of Ubuntu 20.04 with no previous LLVM or C compiler installed.

Install LLVM 11

  apt update
  apt install wget lsb-release software-properties-common
  bash -c "$(wget -O - https://apt.llvm.org/llvm.sh 11)"
  ln -s /usr/lib/llvm-11/bin/lld   /usr/bin/lld 
 ln -s /usr/lib/llvm-11/bin/clang /usr/bin/clang
@hdorio
hdorio / revprox.go
Created June 13, 2017 13:12
reverse proxy qui dump la reponse du service dans un fichier
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/http/httputil"
_ "net/http/pprof"
#!/usr/bin/env ruby
# Send commands by ssh on remote host for a sshfs mounted directory
#
# Install : rename this 'sshdo' (I suggest in /usr/bin/)
# Usage : $sshdo command
# Credits : python version by cbenz see it at http://cbenz.pointique.org/post/2009/09/18/Travailler-avec-sshfs
# Author: Hadrien Dorio <hadrien.dorio at gmail.com>
if ARGV.size < 1
puts 'please enter a command'; exit 1