Skip to content

Instantly share code, notes, and snippets.

View fidergo-stephane-gourichon's full-sized avatar

Stéphane Gourichon fidergo-stephane-gourichon

View GitHub Profile
@fidergo-stephane-gourichon
fidergo-stephane-gourichon / self_referencing_construct_with_deep_self_references.c
Created July 2, 2023 19:46
In C, compile time constant structs and array with deep self-reference.
/* Summary: In C, compile time constant structs and array with deep self-references.
** Context: const and compile-time constants
Constructs fully determined at compile time have some benefits.
But const in C is weaker than constexpr that C++ has.
As prog-fh summarizes on
https://stackoverflow.com/questions/66144082/why-does-gcc-clang-handle-code-slightly-differently-example-given
@fidergo-stephane-gourichon
fidergo-stephane-gourichon / dec18.py
Last active December 19, 2020 20:01
Advent of code, step 1: an unusual math context where operators have no priority!
#!/usr/bin/env python3
import itertools
from enum import Enum, auto
import re
import logging
import sys
import numbers
logging.basicConfig(level=logging.INFO, stream=sys.stderr)
@fidergo-stephane-gourichon
fidergo-stephane-gourichon / gist:049156c7856477f44ddfe58fc97d7def
Created January 28, 2020 15:19
Wishbone Tool 0.6.7 FOMU reset log.
git remote -v show
origin https://github.com/litex-hub/wishbone-utils (fetch)
origin https://github.com/litex-hub/wishbone-utils (push)
git describe
v0.6.7
RUST_LOG=debug wishbone-tool --version
# Build log
# Precompiled toolchain
Binaries from https://github.com/im-tomu/fomu-toolchain/releases/download/v1.5.3/fomu-toolchain-linux_x86_64-v1.5.3.tar.gz
ld: libm.a(lib_a-sf_expm1.o): in function `.L0 ':
sf_expm1.c:(.text+0x4e0): undefined reference to `__math_oflowf'
@fidergo-stephane-gourichon
fidergo-stephane-gourichon / test_xfconf_keys.sh
Created January 1, 2020 09:54
Bug in xfconf-query regarding setting keys shortcuts?
# Let's query some keyboard shortcut
xfconf-query -c xfce4-keyboard-shortcuts -p '/xfwm4/default/<Alt><Shift>Tab' ; echo $?
cycle_reverse_windows_key
0
# So far so good.
# Let's remove that shortcut.
echo {} /* >/dev/null SG\MARKER\VERY\IMPROBABLE\STRING\MY\START
# This file is both a valid CSS style sheet,
# and a valid bash script.
# It adjusts your main Firefox profile so that github and all the
# stackexchange websites do not artifically limit main area width.
# Hooray! No more clobbered listings!
# More technically, it configures and enables userContent.css. It
@fidergo-stephane-gourichon
fidergo-stephane-gourichon / git_path_to_github_url.sh
Last active August 14, 2019 15:45
This bash script will transform a relative or absolute path to file or dir into a github URL you can browse and share.
#!/bin/bash
# Transform a relative or absolute path to file or dir into a github URL you can browse and share.
#
# usage: git_path_to_github_url.sh -
# usage: git_path_to_github_url.sh somedir/somefile
for ENTRY
do
(
@fidergo-stephane-gourichon
fidergo-stephane-gourichon / .gitconfig
Created November 23, 2018 16:01
A sample .gitconfig file.
[core]
editor = edite
[user]
name = FIXME put your name here, to be included into each commit
email = FIXME put your e-mail address here, to be included into each commit
[color]
ui = auto
[alias]
st = status
[merge]
@fidergo-stephane-gourichon
fidergo-stephane-gourichon / outlet
Created June 17, 2018 21:19 — forked from awaxa/outlet
apc pdu outlet expect script
#!/usr/bin/expect
set timeout 3
if {[llength $argv] == 0} {
send_user "Usage: outlet [1-8] [on|off|reboot] \n"
exit 1
}
set number [lindex $argv 0]
set onoff [lindex $argv 1]
*** Error in `/usr/bin/darktable': double free or corruption (!prev): 0x00007fe2d415d040 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fe32df897e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7fe32df9237a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fe32df9653c]
/usr/lib/x86_64-linux-gnu/darktable/plugins/libdenoiseprofile.so(process_sse2+0xf8d)[0x7fe2d944fc0d]
/usr/bin/../lib/x86_64-linux-gnu/darktable/libdarktable.so(+0x124c89)[0x7fe32e61dc89]
/usr/bin/../lib/x86_64-linux-gnu/darktable/libdarktable.so(+0x122444)[0x7fe32e61b444]
/usr/bin/../lib/x86_64-linux-gnu/darktable/libdarktable.so(+0x122683)[0x7fe32e61b683]
/usr/bin/../lib/x86_64-linux-gnu/darktable/libdarktable.so(+0x122683)[0x7fe32e61b683]