Skip to content

Instantly share code, notes, and snippets.

View creaktive's full-sized avatar
👽
🛸

Stanislaw Pusep creaktive

👽
🛸
View GitHub Profile
@creaktive
creaktive / sfjq.sh
Last active March 28, 2024 20:01
jq <3 SalesForce
alias sfjq='jq '\''if .status==0 then .result.records[]|[paths(scalars) as $p|{"key":$p|join("."),"value":getpath($p)}|select(.key|test("\\battributes\\b")|not)]|from_entries else .message|halt_error(1) end'\'
@creaktive
creaktive / amazon-ip-ranges.pl
Created March 5, 2024 13:14
AWS IP address ranges scanner
#!/usr/bin/env perl
use strict;
use warnings qw(all);
use constant IP_RANGES_JSON => 'https://ip-ranges.amazonaws.com/ip-ranges.json';
use JSON::PP qw();
use LWP::Simple qw();
use NetAddr::IP qw();
@creaktive
creaktive / spilling-bee.sh
Created February 27, 2024 16:38
New York Times Spelling Bee cheat
# scrape the answers from the game
curl -qs 'https://www.nytimes.com/puzzles/spelling-bee' \
--compressed \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:123.0) Gecko/20100101 Firefox/123.0' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8' \
-H 'Accept-Language: en-US,en;q=0.5' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Connection: keep-alive' \
-H 'Upgrade-Insecure-Requests: 1' \
-H 'Sec-Fetch-Dest: document' \
@creaktive
creaktive / parser.pl
Created May 16, 2023 18:22
iTerm2 color scheme parser
#!/usr/bin/env perl
use 5.036;
local $/ = undef;
$_ = <>;
while (
m{
(?(DEFINE)
(?<float> \d+\.\d+)
@creaktive
creaktive / midi.pl
Created December 3, 2022 14:16
simplest MIDI file writer
#!/usr/bin/env perl
use 5.036;
my $ch = 0;
my $division = 960;
my $note_off = 0x80;
my $note_on = 0x90;
my $track = '';
$track .= pack('wC3', 23, $note_on + $ch, 69, 126);
@creaktive
creaktive / Aggregated-GitHub-traffic-stats.sh
Created November 30, 2022 16:28
Aggregated GitHub traffic stats
gh repo list --limit 999 --no-archived --visibility public --json nameWithOwner --jq '.[] | .nameWithOwner' |\
PAGER= xargs -I% gh api repos/%/traffic/views --jq 'select(.count != 0) | [.count, .uniques, "https://github.com/%"] | join("\t")' |\
sort -nrk2
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"id": "Condition",
"index": 0,
"name": "Condition",
"normalized_value": 0,
"text": "0",
@creaktive
creaktive / keybindings.json
Created May 6, 2022 09:18
VSCode fix for Alt+. in Terminal
[
{
"key": "alt+.",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "\u001b." }
}
]
@creaktive
creaktive / benchmark.cpp
Created April 1, 2022 10:12
pianolizer benchmark
/*
* 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 March 25, 2021 15:18
Mandelbrot set plot, implemented as GLSL fragment shader
// 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;