Skip to content

Instantly share code, notes, and snippets.

View aynik's full-sized avatar

Pablo Vazquez aynik

View GitHub Profile
@aynik
aynik / quiet-profiles.json
Created February 14, 2024 23:04
MD Data quiet profile
{
"md": {
"mod_scheme": "arb256opt",
"checksum_scheme": "crc32",
"inner_fec_scheme": "none",
"outer_fec_scheme": "rs8",
"frame_length": 8192,
"modulation": {
"center_frequency": 7396,
"gain": 0.02
@aynik
aynik / find-mnemonic.js
Created January 23, 2024 10:21
Finds a valid BIP39 mnemonic in a soup of characters
#!/usr/bin/env node
const stdin = require("get-stdin");
const crypto = require("crypto");
const dictionary =
"abandon ability able about above absent absorb abstract absurd abuse access accident account accuse achieve acid acoustic acquire across act action actor actress actual adapt add addict address adjust admit adult advance advice aerobic affair afford afraid again age agent agree ahead aim air airport aisle alarm album alcohol alert alien all alley allow almost alone alpha already also alter always amateur amazing among amount amused analyst anchor ancient anger angle angry animal ankle announce annual another answer antenna antique anxiety any apart apology appear apple approve april arch arctic area arena argue arm armed armor army around arrange arrest arrive arrow art artefact artist artwork ask aspect assault asset assist assume asthma athlete atom attack attend attitude attract auction audit august aunt author auto autumn average avocado avoid awake aware away awesome awful awkward axis baby ba
@aynik
aynik / save_graph.py
Created November 14, 2023 01:51
Save an entire graph of dicts as django model instances
from copy import copy
from dataclasses import asdict
from typing import Any, Dict, cast
from django.conf import settings
from django.db import models
from django.db.models import Q
from inflection import pluralize
@aynik
aynik / chat-bridge.js
Last active November 14, 2023 04:23
ChatGPT Web to CLI Bridge & Http API
(() => {
let websocket;
// Selectors
const textareaSelector = "textarea";
const submitButtonSelector = "button";
const containerSelector = ".group.bg-gray-50";
const contentSelector = ".whitespace-pre-wrap";
// Utilities
@aynik
aynik / transcodarr.sh
Created February 27, 2023 02:14
Post processing custom script for *arr services
#!/usr/bin/env bash
set -e
[[ "$radarr_eventtype" == "Test" || "$sonarr_eventtype" == "Test" ]] && exit 0
# Determine if the script is being run by Radarr or Sonarr
if [[ -n "$radarr_moviefile_path" ]]; then
# Running in Radarr
input_file="$radarr_moviefile_path"
output_file="${input_file%.*}.mp4"
@aynik
aynik / crossfade.sh
Created February 15, 2023 00:40
Crossfade two audio tracks using sox
#!/bin/bash
fade_length="$1"
first_file="$2"
second_file="$3"
fade_first="auto"
if [ "$4" != "" ]; then
fade_first="$4"
fi
@aynik
aynik / mixtape-video-spectrum.sh
Created February 15, 2023 00:38
Mixtape video with cover art background and audio spectrum visualization
#!/usr/bin/env bash
set -e
font_file="~/Library/Fonts/GoNotoCurrent.ttf"
function ellipsis (){
awk -v len=$1 '{ if (length($0) > len) print substr($0, 1, len-3) "..."; else print; }'
}
for file in "$@"; do
@aynik
aynik / mixtape-video.sh
Created February 15, 2023 00:36
Mixtape video with video background
#!/usr/bin/env bash
font_file="~/Library/Fonts/GoNotoCurrent.ttf"
video_background="$1"
shift
function ellipsis (){
awk -v len=$1 '{ if (length($0) > len) print substr($0, 1, len-3) "..."; else print; }'
}
@aynik
aynik / concat-tags
Last active January 25, 2023 13:43
netmd-session
#!/usr/bin/env bash
sed "s/.*=//g" \
| tr "\n" "|" \
| sed "s/|/ - /" \
| sed "s/\// /" \
| sed "s/ō/ou/g" \
| sed "s/ū/uu/g" \
| sed "s/ī/ii/g" \
| sed "s/ā/aa/g" \
| sed "s/ē/ee/g" \
@aynik
aynik / mix-bytes.c
Created June 13, 2022 11:25
mix-bytes
#!/usr/bin/env C -m
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
void mix_bytes(const char *in_even_fname, const char *in_odd_fname, int bytes)
{
int c;
FILE *fin_odd, *fin_even;
fin_even = fopen(in_even_fname, "rb");