Skip to content

Instantly share code, notes, and snippets.

View mathieucaroff's full-sized avatar

Mathieu CAROFF mathieucaroff

View GitHub Profile
@mathieucaroff
mathieucaroff / ISC.txt
Created September 17, 2021 11:04
ISC (723) vs MIT (1060) vs NTP (695)
Copyright <YEAR> <OWNER>
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<style>
</style>
</body>
</html>
// ==UserScript==
// @name Align Youtube Ponies@Dawn
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Make the video always occupy the same column, so as to make them easier to find
// @author Mathieu CAROFF
// @match https://www.youtube.com/channel/UCSJW3EMxeuQXZ00h4bihXvA/videos
// @grant none
// ==/UserScript==
@mathieucaroff
mathieucaroff / download-buidl-and-install-ghdl.sh
Created September 28, 2018 09:50
Download build and install GHDL on Ubuntu 18.04 (tested 2018-09-28)
#!/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 / sequenceView.py
Last active May 25, 2023 04:51
Create a (read only) slice without creating a copy of the given sequence.
# 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.
@mathieucaroff
mathieucaroff / negateExitCode.js
Created June 5, 2023 08:52
node JS script to negate the exit code of the command passed as parameter
/**
* Spawn the given command with its arguments, exit with the inverse of the
* exit code of the spawned command: exits 0 if the code is anything other
* than 0, and exits with 1 if the code is 0.
*
* Usage:
*
* node scripts/utils/negateExitCode.js <command> [<arguments>...]
*
* Examples:
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 / util_str.vhd
Created November 20, 2018 11:20
VHDL Utilitary functions to convert std_logic_vector(s) to strings
-- 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
-- ```