Skip to content

Instantly share code, notes, and snippets.

Avatar
👽
🛸

Stanislaw Pusep creaktive

👽
🛸
View GitHub Profile
@creaktive
creaktive / keybindings.json
Created May 6, 2022
VSCode fix for Alt+. in Terminal
View keybindings.json
[
{
"key": "alt+.",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "\u001b." }
}
]
@creaktive
creaktive / benchmark.cpp
Created Apr 1, 2022
pianolizer benchmark
View benchmark.cpp
/*
* wget https://github.com/creaktive/pianolizer/raw/master/cpp/pianolizer.hpp
* g++ -Ofast -std=c++14 -o benchmark benchmark.cpp
*/
#include <chrono>
#include <iostream>
#include <stdlib.h>
#include "pianolizer.hpp"
@creaktive
creaktive / mandelbrot.frag
Created Mar 25, 2021
Mandelbrot set plot, implemented as GLSL fragment shader
View mandelbrot.frag
// shamelessly stolen from https://p5js.org/reference/#/p5/loadShader
// ported to work with https://thebookofshaders.com/edit.php
precision highp float;
const int I = 500;
void main() {
vec2 vPos = gl_FragCoord.xy;
vec2 p = vec2(-0.74364388703, 0.13182590421);
float r = .00001;
vec2 c = p + vPos * r, z = c;
float n = 0.0;
View gist:cae8e75d7597e0f27cf6f11599f8b2c6
find ~/.local/share/Modartt/Pianoteq/Archive/ -type f -name \*.mid | sort | perl -MYAML::XS -nE 'if ( m{(\d{4}-\d{2}-\d{2}).+?(\d+)\s+notes,\s+(\d+)\s+seconds} ) { $s{$1}{notes} += $2; $s{$1}{minutes} += $3 / 60 } else { die } }{ say Dump \%s'
@creaktive
creaktive / gist:936dc156bd8df3ddf0c25bd7a19943be
Created Jun 17, 2020
was any of my 100 recent git commits reverted?
View gist:936dc156bd8df3ddf0c25bd7a19943be
git log -P --grep "This reverts commit ($( git log --author=$USER --format=%H | head -n 100 | paste '-sd|' ))"
@creaktive
creaktive / recent.sh
Created Mar 12, 2020
psyndora recent tracks CLI
View recent.sh
curl -q -s 'https://cast.magicstreams.gr:2199/external/rpc.php?m=recenttracks.get&username=psyndora&charset=&mountpoint=&rid=psyndora&limit=10' | \
jq -c '.data[0][] | [.localtime, .artist, .album, .title]'
View cli-vj.sh
# requirements: curl, ffmpeg, youtube-dl
mkdir ttaass.com
chdir ttaass.com
curl https://www.ttaass.com |\
perl -nE 'say $1 while m{"(http://www\.youtube\.com[^"]+)}g' |\
sort -u |\
xargs -n 1 youtube-dl -f 'bestvideo[ext=mp4,width=1920,height=1080]'
# delete the unwanted ones...
@creaktive
creaktive / hilbert-curve.pl
Created Dec 31, 2018
Recursive Hilbert Curve generator
View hilbert-curve.pl
#!/usr/bin/env perl
# http://www.fundza.com/algorithmic/space_filling/hilbert/basics/
# http://www.soc.napier.ac.uk/~andrew/hilbert.html
use strict;
use warnings;
sub hilbert {
my ($n, $x, $y, $xi, $xj, $yi, $yj, $mn) = (@_, qw(0 0 1) x 2, $_[0]);
return !$n
? [
@creaktive
creaktive / c5.pl
Last active Nov 21, 2019
heptatonic scale generator
View c5.pl
#!/usr/bin/env perl
# inspired by https://randscullard.com/CircleOfFifths/
# and http://pages.mtu.edu/~suits/notefreqs.html
use 5.010;
use strict;
use warnings;
use charnames ();
use open OUT => ':locale';
use utf8;
@creaktive
creaktive / rainbow.pl
Last active Sep 25, 2018
Convert light wave length (in nm) to RGB
View rainbow.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Carp;
use POSIX;
# Ported to Perl from: https://github.com/ArashPartow/bitmap/blob/master/bitmap_image.hpp
# Credits: Dan Bruton http://www.physics.sfasu.edu/astro/color.html
sub convert_wave_length_nm_to_rgb {