Skip to content

Instantly share code, notes, and snippets.

Avatar

Mathieu CAROFF mathieucaroff

  • IMT Atlantique
  • Montigny-le-Bretoneux
View GitHub Profile
@mathieucaroff
mathieucaroff / download-buidl-and-install-ghdl.sh
Created Sep 28, 2018
Download build and install GHDL on Ubuntu 18.04 (tested 2018-09-28)
View download-buidl-and-install-ghdl.sh
#!/bin/sh
#
# download-buidl-and-install-ghdl.sh
#
# It took about 5 minutes on my laptop (2018-09-28).
sudo apt update
sudo apt install -y git make gnat zlib1g-dev
git clone https://github.com/ghdl/ghdl
cd ghdl
@mathieucaroff
mathieucaroff / .tmux.conf
Last active Jun 10, 2020 — forked from jnaulty/.tmux.conf
A copy of the best tmux and vim configuration in the universe
View .tmux.conf
#.tmux.conf
# upstream
# https://gist.github.com/jnaulty/55d03392c37e9720631a
# obtain
# ```bash
# curl https://gist.githubusercontent.com/mathieucaroff/7037f7f40e359d6a605638872bfd19c2/raw/.tmux.conf --output ~/.tmux.conf
# ```
View linenumber.go
package main
// An example of use of the go yaml v3 Node API
// Disclaimer: I'm very new to go. This code may miss a lot of Go goodnesses
import (
"bytes"
"fmt"
"io"
"log"
@mathieucaroff
mathieucaroff / sequenceView.py
Last active Jun 1, 2020
Create a (read only) slice without creating a copy of the given sequence.
View sequenceView.py
# stackoverflow.com/q/3485475/can-i-create-a-view-on-a-python-list
# This solution is based on python 3 range ability to be sliced and indexed
# in constant time.
#
# It supports slicing, equality comparsion, string casting, and reproducers,
# but doesn't support assigment (and I don't plan to add support for it).
#
# Creating a SliceableSequenceView of a SliceableSequenceView won't slow down
# access times as this case is detected.
View expandedLog.ts
var MAX_DEPTH = 20
export var expandedLog = (obj: Record<string, unknown>, depth: number = 0) => {
var [[name, item]] = Object.entries(obj)
if (depth < MAX_DEPTH && typeof item === 'object' && item) {
var typeString = Object.prototype.toString.call(item)
var objType = typeString.replace(/\[object (.*)\]/, '$1')
console.group(`${name}: ${objType}`)
Object.entries(item).forEach(([key, value]: any) => {
@mathieucaroff
mathieucaroff / git-setup-snippet.md
Created Jan 28, 2019
A copy-past of the default helper snippets shown on Gitlab in empty repositories (2019-01-28)
View git-setup-snippet.md

Command line instructions

Git global setup

git config --global user.name "Mathieu CAROFF"
git config --global user.email "mathieu.caroff@free.fr"

Create a new repository

@mathieucaroff
mathieucaroff / util_str.vhd
Created Nov 20, 2018
VHDL Utilitary functions to convert std_logic_vector(s) to strings
View util_str.vhd
-- Mathieu CAROFF
-- 2018-11-20
-- util_str.vhd
-- Utilitary functions to convert std_logic_vector(s) to strings
-- Test:
-- ```bash
-- ghdl -a util_str.vhd
-- ghdl -r util_str_tb
-- ```
@mathieucaroff
mathieucaroff / test-shell-default-variables.sh
Created Nov 6, 2018
Test shell variables to know how to determine path to the current shell script. Includes sample script output.
View test-shell-default-variables.sh
#!/bin/bash
# test-shell-default-variables.sh
# Usage examples (you might want to `sudo apt install zsh ksh`):
#
# ./test-shell-default-variables.sh dash bash
# ./test-shell-default-variables.sh dash bash zsh ksh
# ./test-shell-default-variables.sh dash bash zsh ksh | less -R
@mathieucaroff
mathieucaroff / raspi3-router-tuto.md
Last active Nov 1, 2018
Using a raspberryPi 3 as wifi router
View raspi3-router-tuto.md

Using a raspberryPi 3 as wifi router

... with raspbian OS

Written after trying a number of other techniques which failed. (2018-08-31)

I. Get Network-Manager to work on Raspbian

By default, because of a bug, Network-Manager doesn't manage wifi. It can be worked around though.

@mathieucaroff
mathieucaroff / text-circle.py
Created Oct 17, 2018
Fill a circle with 0s and 1s
View text-circle.py
#!/usr/bin/env python3
#
# Fill a circle with 0 and 1's
# The circle is made of half as many lines as it is made of columns.
# This way, it usually appears round (with most terminal fonts at least).
# Accept the circle's width-radius as argument. See the default radius r, below.
r = 15
from sys import argv
if len(argv) > 1:
You can’t perform that action at this time.