Skip to content

Instantly share code, notes, and snippets.

@tripulse
tripulse / lndkrss.py
Created October 31, 2019 15:27
Simple audio file extractor solely made to extract files from "The Lunduke Show's" RSS feed.
from collections import namedtuple
from urllib.request import urlopen, URLError
from xml.etree import ElementTree
import os
REPLACE_DELIM = '_'
POSIX_ILLEGAL = '/'
WINNT_ILLEGAL = '<>:"/\\|?*'
def to_compat(filename: str, delimeter: str) -> str:
@tripulse
tripulse / strip2byte.py
Last active June 24, 2020 04:34
A small script to strip characters in filenames that don't fall in the range of 7-bit ASCII codepoints. This script is useful if the filename should be restricted to English (letters+punctuations).
#!/bin/python
import glob
from sys import argv
from argparse import ArgumentParser
from os import rename
_parser = ArgumentParser(
"Strip28Bit",
description= "Strips multi-byte UNICODE strings in"
" filenames into 7-bit ASCII strings",
// The MIT License (MIT)
//
// Copyright (c) 2019 vnullptr
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@tripulse
tripulse / YTWaveForm.js
Last active May 21, 2019 14:41
Waveform/Time-Domain view of a YouTube video's audio stream
var audioCtx = new AudioContext();
var source = audioCtx.createMediaElementSource(
document.querySelector('video')
);
var analyser = audioCtx.createAnalyser();
source.connect(analyser);
analyser.connect(audioCtx.destination);
analyser.fftSize = 1024;
@tripulse
tripulse / ET.js
Created May 12, 2019 17:21
The emote-transform API in JavaScript. Transforms normal-English text to Emotes.
/**
* (c) Copyright 2019 nullptr.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@tripulse
tripulse / index.html
Last active August 23, 2020 01:46
Online Notepad
<input type="file" accept="text/*" id="file"/>
<label for="file">Upload file</label> <span class="h1_defui">OnlineNotepad — A plain online text editor</span>
<textarea id="editor"></textarea>
<br/>
<input id="fname" placeholder="filename"/>
<button id="fsave">Save File</button>
@tripulse
tripulse / sample.ef
Last active November 6, 2019 09:42
New and rich programming language.
$print("Hello World");
# THESE ARE COMMENTS, THEY ONLY EXIST IT SOURCE CODE
# AND INGORED BY THE LEXER BEFORE COMPILING.
def x: f24 = 75; # Variables types can be defined while initalization but, cannot be changed later.
def y = 75; # EXCEPTION: if type is not explictly declared then type of variable can be changed later.
def z: inh = $format("%d", x);
# 'inh' keywords infers the type from the value but the type cannot be changed later.
@tripulse
tripulse / wv.js
Last active May 15, 2020 03:42
A waveform visualiser for YouTube
/** Mapping of x from range [a..b) to [c..d). */
Math.map = (x, a,b, c,d) => x + (d-c)/(b-a) + c;
var audioCtx = new AudioContext();
var source = audioCtx.createMediaElementSource(
document.querySelector('video')
);
var analyser = audioCtx.createAnalyser();
source .connect(analyser);
@tripulse
tripulse / waveform_visualiser.js
Last active April 14, 2019 15:57
I don't what I'm doing
var audioCtx = new AudioContext();
var source = audioCtx.createMediaElementSource(document.querySelector('video'));
var analyser = audioCtx.createAnalyser();
source.connect(analyser);
analyser.connect(audioCtx.destination);
// FFTSize to analyse
analyser.fftSize = 8192;
// analyser.smoothingTimeConstant = 0.2;
@tripulse
tripulse / Math.map.js
Created February 28, 2019 11:27
The p5's map function in native JavaScript!
/**
* @description Maps a number in a range into another range.
* @param {Number} val - The value to map.
* @param {Number} v_min - The minimum value of the 'value'.
* @param {Number} v_max - The maximum value of the 'value'.
* @param {Number} m_min - The minimum value to map.
* @param {Number} m_max - The maximum value to map.
* @returns Number