Skip to content

Instantly share code, notes, and snippets.

View sebastien's full-sized avatar

Sébastien Pierre sebastien

View GitHub Profile

Shadertoy Language

Language

Preprocessor: # #define #undef #if #ifdef #ifndef #else #elif #endif #error #pragma #extension #version #line
Operators: () + - ! * / % < > <= >= == != && ||
Comments: // /* */
@sebastien
sebastien / fish_hg_prompt.fish
Created December 6, 2017 14:51
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
@sebastien
sebastien / nix-fishgen.py
Last active May 31, 2021 02:52
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.
"""
" 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'})
@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`
@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() {
// 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.
// 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
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;
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