Skip to content

Instantly share code, notes, and snippets.

View sebastien's full-sized avatar

Sébastien Pierre sebastien

View GitHub Profile
$ nix-shell --pure build/nix-environment.7d4e39546b1c2f87bebbd467b5fcc55f.nix
this derivation will be built:
/nix/store/8pk0rb4d3a09wb7klpdy9rdhrx0cx2lh-python3.10-awslambdaric-2.0.0.drv
building '/nix/store/8pk0rb4d3a09wb7klpdy9rdhrx0cx2lh-python3.10-awslambdaric-2.0.0.drv'...
Sourcing python-remove-tests-dir-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing setuptools-build-hook
Using setuptoolsBuildPhase
Using setuptoolsShellHook
@sebastien
sebastien / pandoc-code.css
Created May 21, 2021 23:18
Pandoc Syntax Higlighting CSS
/* FROM: https://github.com/jeffbr13/benjeffrey.com/blob/master/posts/pandoc-syntax-highlighting-css.md */
pre { background-color: #FDF6E3; }
.sourceCode .kw { color: #268BD2; }
.sourceCode .dt { color: #268BD2; }
.dv, .sourceCode .bn, .sourceCode .fl { color: #D33682; }
.sourceCode .ch { color: #DC322F; }
.sourceCode .st { color: #2AA198; }
.sourceCode .co { color: #93A1A1; }
.sourceCode .ot { color: #A57800; }
.sourceCode .al { color: #CB4B16; font-weight: bold; }
# encoding: utf-8
from math import cos, sin, acos, asin, atan2, sqrt, pi
"""
A simple sketch to make sure spherical projection and unprojections work
properly. There are many ways to encode them, so this one assumes
THETA as rotating around Y (horizontal plane positionning) and PHI as the
rotation around Z (vertical positioning), so that THETA can be considered
the spherical X and PHI the spherical Y.
let
EPSILON = 0.001;
between (v,a,b) = 1 - smoothstep(a-EPSILON,a+EPSILON,v) + smoothstep(b-EPSILON,b+EPSILON,v);
prel (v,a,b) = (v - a)/(b - a);
scale (v,a,b) = lerp(b[0],b[1],prel(v,a[0],a[1]));
hash x = frac(sin(x)*100000.0);
wave (x,y,z,t) = let
let
hash2x2 xy = frac([262144, 32768] * sin(dot(xy, [41, 289])));
// TODO: Rephrase in a more functional style, compose passes for clarity.
// TODO: The voronoi input should be a vec3
// TODO: There seems to be some odd artifacts
//matrix (n,m) = [for (i in 0..<floor(n*m)) [mod(i,n),floor(i/n)] ];
between(v,a,b) = if (a <= v && v <= b) 0.0 else 1.0;
// A study of rendering varyingly shaped points with randomized positions
// with a discrete gradient o density.
//
// Ref: https://www.tylerlhobbs.com/works/item/st-c
//
// It is an opportunity to study randomness (or pseudo-randomness) in curv,
// as well as how to define varying densities of points.
let
// Triangle study
// Ref: https://otakugangsta.com/image/180451216975
let
w = 28;
h = 34;
black = (0.016, 0.031, 0.027);
// NOTE: Here we need to add an EPSILON otherwise the polygon
// drawing will fail.
@sebastien
sebastien / show-ansi-colors.sh
Created October 25, 2018 20:49 — forked from eliranmal/show-ansi-colors.sh
spits N ansi colors to the terminal
#!/usr/bin/env sh
usage() {
echo "show-ansi-colors <n>"
exit 0
}
(( $# < 1 )) && usage
show_ansi_colors() {
@sebastien
sebastien / acpi_yogaX1_fedora28
Created September 5, 2018 14:39 — forked from javanna/acpi_yogaX1_fedora28
S3 deep sleep for Lenovo yoga X1 3rd Generation on Fedora 28
This is a step-by-step guide on how make sleep mode work with a Lenovo Yoga X1 3rd generation running Fedora 28 (UEFI based system).
Kernel version: 4.17.4-200.fc28.x86_64
Credits: most of this guide comes from `https://delta-xi.net/#056`. The patch I used is a little different though, taken from http://kernel.dk/acpi.patch
(found through https://bbs.archlinux.org/viewtopic.php?pid=1794150#p1794150), and some of the steps slightly differ as well as mine is a UEFI based system.
1. Reboot, enter BIOS/UEFI. Go to Config - Thunderbolt (TM) 3 - set Thunderbolt BIOS Assist Mode to Enabled. Set also Security - Secure Boot to Disabled.
2. Install iasl (Intel's compiler/decompiler for ACPI machine language) and cpio: `sudo yum install acpica-tools cpio`
" Test completion on NeoVim. Completion should automatically pop-up on
" insertion.
silent! packadd minpac
if !exists('*minpac#init')
!mkdir $(dirname $MYVIMRC)/pack/minpac/opt ; true
!git clone https://github.com/k-takata/minpac.git $(dirname $MYVIMRC)/pack/minpac/opt/minpac
silent! packadd minpac
endif
call minpac#init()
call minpac#add('k-takata/minpac', {'type': 'opt'})