Preprocessor: # #define #undef #if #ifdef #ifndef #else #elif #endif #error #pragma #extension #version #line
Operators: () + - ! * / % < > <= >= == != && ||
Comments: // /* */
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
usage() { | |
echo "show-ansi-colors <n>" | |
exit 0 | |
} | |
(( $# < 1 )) && usage | |
show_ansi_colors() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |