Skip to content

Instantly share code, notes, and snippets.

View gawen's full-sized avatar

Gawen Arab gawen

View GitHub Profile
package main
import (
"context"
"log"
"time"
"github.com/ngrok/ngrok-go"
ngrokconfig "github.com/ngrok/ngrok-go/config"
)
@gawen
gawen / README
Created February 14, 2020 12:49
VIM cheatsheet
i: interactive mode
v: visual mode
escape to go back to no mode
# classic commands
:e <filename>: open <filename> in current window
:e **/<filename>: fuzzy search for <filename>
:w [<filename>]: write current window
:q: quit
@gawen
gawen / 0001-avoid-cyclic-assigment-of-.ra.patch
Last active October 24, 2019 12:14
breakpad patch to avoid the pseudo-register .ra to be self-assigned
From 13a5ab8b7f1a427182027ad6e3a2f64246fe27a7 Mon Sep 17 00:00:00 2001
From: Gawen Arab <[email protected]>
Date: Thu, 24 Oct 2019 12:54:16 +0200
Subject: [PATCH] fix: DW_CFA_same_value of the return address for .ra
A DWARF CFI rule `DW_CFA_same_value` of the return address register
assigned to `.ra` should reload the return address register and assign
it to `.ra`. The recorded rule should be `.ra: <address register>`.
But `DwarfCFIToModule::RegisterName` always replaced the return address
@gawen
gawen / 0001-add-ld-option-alwaysRestoreDWARFLinkRegister-false.patch
Created October 23, 2019 19:01
add ld option '-alwaysRestoreDWARFLinkRegister[=false}' for go1.13.1
From 0b30d58c6b06dcdb8203f400c1b74ec08392a08f Mon Sep 17 00:00:00 2001
From: Gawen Arab <[email protected]>
Date: Wed, 23 Oct 2019 19:37:41 +0200
Subject: [PATCH] add ld option '-alwaysRestoreDWARFLinkRegister[=false}'
---
src/cmd/link/internal/ld/dwarf.go | 2 +-
src/cmd/link/internal/ld/link.go | 2 ++
src/cmd/link/internal/ld/main.go | 1 +
3 files changed, 4 insertions(+), 1 deletion(-)
@gawen
gawen / iir.c
Last active July 7, 2019 20:44
IIR filter sample implementation
#define P 3
#define Q 3
const float feedforward_coeffs[P] = { 0.0316, -0.06319, 0.0316 };
const float feedback_coeffs[Q] = { 0.99835, -1.99835, 1.0 };
float feedforward_buf[P] = { 0.0 };
float feedback_buf[Q] = { 0.0 };
float pass(float inp) {
@gawen
gawen / mac.py
Created November 26, 2018 11:40
Calculate all MAC addresses between two MAC addresses.
# Everything prefixed by a # is a comment, and therefore is read by human and
# ignored by the machine
# First MAC address of the batch
FIRST_MAC = "E08E3C3923A2"
# Last MAC address of the batch
LAST_MAC = "e08e3c393234"
# we convert the first and last macs in decimals. To do so, we call 'int' with
@gawen
gawen / server.js
Created December 2, 2016 14:28
HTTP Digest Auth with express, passport-http and routers
var express = require('express'), http = require('http');
var app = express();
var passport = require('passport');
var Strategy = require('passport-http').DigestStrategy;
passport.use(new Strategy(
{ qop: "auth" },
function(username, done) {
return done(null, {}, "password");

Keybase proof

I hereby claim:

  • I am gawen on github.
  • I am gawenr (https://keybase.io/gawenr) on keybase.
  • I have a public key ASAA85dRvVCjFKMusnK7qLNpzmyqK-04XNoGDHNOFZTQiQo

To claim this, I am signing this object:

@gawen
gawen / README.md
Created February 22, 2016 10:20
Back-end & Back-office Engineer

Back-end & Back-office Engineer

Lima is a revolutionary and innovative technology that consolidates all of your content, enabling you to browse the same files on all of your devices regardless of operating system or device size. Composed of a smart hardware adapter and an app for each platform, Lima enables users to easily and seamlessly access their entire digital library from all of their devices, wherever they are.

Lima was the first French startup to raise more than one million dollars on the American crowdfunding platform Kickstarter. Today, the company is growing and wants to reinforce its technical team. At Lima, each person is really important! To learn more about our team, have a look at https://meetlima.com/blog/?p=181

For more information, visit http://www.meetlima.com and you can see our office and the team on tyba: http://tyba.com/company/lima/about/

You will be Back-end & Back-office developer at Lima. You will work on the internal backoffice, built with Django. You will work on the fron

@gawen
gawen / replace.c
Created February 6, 2015 14:17
Rename/Replace function behind "os.replace" in Python 3
static PyObject *
internal_rename(PyObject *args, PyObject *kwargs, int is_replace)
{
char *function_name = is_replace ? "replace" : "rename";
path_t src;
path_t dst;
int src_dir_fd = DEFAULT_DIR_FD;
int dst_dir_fd = DEFAULT_DIR_FD;
int dir_fd_specified;
PyObject *return_value = NULL;