Skip to content

Instantly share code, notes, and snippets.


Sébastien Pierre sebastien

View GitHub Profile
# 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.
View study-waves-01.curv
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
View study-organic-03.curv
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;
View study-randompoints.curv
// A study of rendering varyingly shaped points with randomized positions
// with a discrete gradient o density.
// Ref:
// It is an opportunity to study randomness (or pseudo-randomness) in curv,
// as well as how to define varying densities of points.
View study-sinetriangles.curv
// Triangle study
// Ref:
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 /
Created Oct 25, 2018 — forked from eliranmal/
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 / acpi_yogaX1_fedora28
Created Sep 5, 2018 — forked from javanna/acpi_yogaX1_fedora28
S3 deep sleep for Lenovo yoga X1 3rd Generation on Fedora 28
View acpi_yogaX1_fedora28
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 ``. The patch I used is a little different though, taken from
(found through, 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`
View init.vim
" 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 $(dirname $MYVIMRC)/pack/minpac/opt/minpac
silent! packadd minpac
call minpac#init()
call minpac#add('k-takata/minpac', {'type': 'opt'})
sebastien /
Last active May 17, 2020
Python script that converts Nix's profile bash script to Fish
#!/usr/bin/env python3
# Updated: 2018-10-17
import re, sys, os
Converts the Nix profile SH script to a Fish-compatible profile using a
simple line-by-line replace algorithm.
sebastien /
Created Dec 6, 2017
Mercurial prompt tools for Fish shell
function fish_hg_prompt --description 'Prompt function for Mercurial'
# BRANCH ⑂3 ‥+-?! [RNNN|D]
# 1 2 3 4 5
# 1 = Current branch/bookmark
# 2 = Number of heads/branches
# 3 = Modified ‥ added + removed - untracked ? merge !
# 4 = Revision number
# 5 = Time since last commit
You can’t perform that action at this time.