Instantly share code, notes, and snippets.

👽
🛸

Stanislaw Pusep creaktive

View GitHub Profile
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
? [
View circle-of-filth.html
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Major & Minor Scales</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:200" rel="stylesheet">
<style>
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 {
View git-hack.sh
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 && \
View sonos-reboot.pl
#!/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();
View k8s-sniffer.go
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
yaml "gopkg.in/yaml.v2"
View genesis_public_key
0452a51fe0fe68af85e58ecba228639ca5486fb782171e23079c5e674035ba5c1a706798d5f07e201f8a7acc876edbc7fe437a3d4ac05931d996addf04485be01a;c-darwin
View gopro.sh
# unwarp, rescale & rename GoPro pics using 4 CPUs
find /Volumes/NO\ NAME/DCIM/ -type f -regex '.*/G[0-9]+.JPG' |
sort |
perl -MPOSIX=strftime -lne 'printf qq(convert "%s" -filter Lanczos -distort barrel "0.06335 -0.18432 -0.13009" -resize 1440x1080 -font Courier -pointsize 32 -draw "gravity southeast fill white text 0,0 \\\"%s\\\"" -quality 100 tl%05d.jpg\0), $_, strftime("%Y-%m-%d %H:%M", localtime [stat($_)]->[9]), ++$i' |
xargs -0 -n1 -P4 sh -c
# build timelapse at 60 fps
ffmpeg -f image2 -framerate 60 -i tl%05d.jpg -s 1440x1080 -pix_fmt yuv420p timelapse.mp4
View display-weather.sh
#!/bin/sh
wifienable() {
lipc-set-prop com.lab126.wifid enable 1
}
wifidisable() {
lipc-set-prop com.lab126.wifid enable 0
}
View euler012.cpp
#include <iostream>
#include <set>
#include <math.h>
int n_divisors(int n) {
int l = sqrt(n);
std::set<int> f;
f.insert(n);
for (int i = 1; i <= l; i++)
if (n % i == 0) {