Skip to content

Instantly share code, notes, and snippets.

View creaktive's full-sized avatar
👽
🛸

Stanislaw Pusep creaktive

👽
🛸
View GitHub Profile
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 June 17, 2020 17:17
was any of my 100 recent git commits reverted?
git log -P --grep "This reverts commit ($( git log --author=$USER --format=%H | head -n 100 | paste '-sd|' ))"
@creaktive
creaktive / recent.sh
Created March 12, 2020 16:33
psyndora recent tracks CLI
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]'
@creaktive
creaktive / cli-vj.sh
Last active October 13, 2019 11:33
CLI VJ
# 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 December 31, 2018 07:51
Recursive Hilbert Curve generator
#!/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 November 21, 2019 19:28
heptatonic scale generator
#!/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 November 24, 2022 18:43
Convert light wave length (in nm) to RGB
#!/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 {
@creaktive
creaktive / git-hack.sh
Created June 15, 2018 06:47
Manually transfer all the commits from one git repo to another
mv .git .git.tmp && \
mv .git.bak .git && \
mv .git.tmp .git.bak && \
git checkout . && \
git checkout $(git rev-list --topo-order HEAD..master | tail -1) && \
CMSG=$(git show -s --format=%s) && \
export GIT_COMMITTER_DATE=$(git show -s --format=%cd) && \
export GIT_AUTHOR_DATE=$(git show -s --format=%ad) && \
mv .git .git.tmp && \
mv .git.bak .git && \
@creaktive
creaktive / sonos-reboot.pl
Last active May 24, 2018 11:11
Reboot all the Sonos speakers in the LAN
#!/usr/bin/env perl
use strict;
use warnings;
use Net::UPnP::ControlPoint;
use WWW::Mechanize;
sub sonos_discover {
my @hosts;
my $cp = Net::UPnP::ControlPoint->new();
@creaktive
creaktive / k8s-sniffer.go
Last active April 11, 2018 09:31
k8s-sniffer
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
yaml "gopkg.in/yaml.v2"