Skip to content

Instantly share code, notes, and snippets.

@tripulse
tripulse / YouTubePoop.js
Created August 25, 2018 10:47
Invention of meme maker.
var video = document.querySelector("video");
function getRandom(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
setInterval(function() {
// video.playbackRate = getRandom(0.07, 1.5);
video.currentTime = getRandom(0, video.duration);
}, 1000);
@tripulse
tripulse / YTOldLayout.js
Last active September 2, 2018 12:08
Tweaks URL little bit and bring old YouTube layout
// ==UserScript==
// @name YouTube Old Layout
// @description Tweaks URL little bit and bring old YouTube layout.
// @match *://www.youtube.com/*
// @exclude *://www.youtube.com/embed/*
// @grant none
// @run-at document-start
// @version 2.0
// ==/UserScript==
#include <stdio.h>
#include <unistd.h>
#define CHUNK 4096
int main()
{
int fd;
char buf[CHUNK];
size_t nRead;
@tripulse
tripulse / file.h
Last active December 10, 2018 13:41
Little POSIX I/O library
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
/* Buffer structure */
typedef structure
{
void* memory;
int64_t size;
@tripulse
tripulse / buffer.h
Last active December 11, 2018 05:30
Little buffer I/O libray
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
/* Buffer structure */
typedef struct
{
void* memory;
uint64_t size;
uint64_t nmemb;
@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,
@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 / QueryStrings.js
Last active March 8, 2019 10:21
Parses QueryString and returns URL agruments.
function GetQueryString( qs ) {
if ( !qs ) return;
var QueryStrings = [];
var SearchParams = new URLSearchParams( qs );
for ( Query of SearchParams ) {
QueryStrings.push( Query );
}
function EntriesToObject( Entries ) {
if ( Array.isArray( Entries ) ) {
@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