Skip to content

Instantly share code, notes, and snippets.

@tripulse
tripulse / bootiso.md
Last active January 23, 2019 02:36
A safe and secure way to make boot-able USB stick in Linux without messing with low level stuff

A bash script that's able create a boot-able USB out of ISO. It has a feature to automatically select USB drive if there's only one mounted. It will prompt you if there are multiple USB drives.

Installation

BootISO is very easy to install in your system. Just download it and paste it in /usr/bin folder. For now, we'll use command-line instead to install it to simplify it.

# We'll download the file into this folder
cd "/usr/bin"
wget "https://git.io/bootiso"
@tripulse
tripulse / dcord-bw.js
Last active January 8, 2019 13:50
The discord bit-wise permissions
const Permissions =
new Object({
CREATE_INSTANT_INVITE: 0x1,
KICK_MEMBERS: 0x2,
BAN_MEMBERS: 0x4,
ADMINISTRATOR: 0x8,
MANAGE_CHANNELS: 0x10,
MANAGE_GUILD: 0x20,
ADD_REACTIONS: 0x40,
enum DiscordPermissions {
CREATE_INSTANT_INVITE = 0x1,
KICK_MEMBERS = 0x2,
BAN_MEMBERS = 0x4,
ADMINISTRATOR = 0x8,
MANAGE_CHANNELS = 0x10,
MANAGE_GUILD = 0x20,
ADD_REACTIONS = 0x40,
VIEW_AUDIT_LOG = 0x80,
@tripulse
tripulse / ytdm.js
Created February 8, 2019 17:33
YouTube Downloader for Music
#!/usr/bin/env node
const YTDL = require('ytdl-core');
const argparse = require('argparse') .ArgumentParser;
const spawn = require('child_process') .spawn;
const createWriteStream = require('fs') .createWriteStream;
const cursorTo = require('readline') .cursorTo;
const flat = require('flat') .flatten;
const c = require('chalk') .default;
const sprintf = require('sprintf-js') .sprintf;
@tripulse
tripulse / cors-esc.js
Last active April 14, 2019 15:58
Shortend version of using fetch and cors-anywhere API
function corsESC(url) {
// The escape method request URL
let CORS_ESC_U = "https://cors-anywhere.herokuapp.com/";
// URL parsed using native object
var p_url = new URL(url);
return fetch(CORS_ESC_U + p_url.href
.replace(/^(https?):/, ''));
}
@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
@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 / 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 / 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 / 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>