Skip to content

Instantly share code, notes, and snippets.

@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 / 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;
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 / 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 / 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 / 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;
#include <stdio.h>
#include <unistd.h>
#define CHUNK 4096
int main()
{
int fd;
char buf[CHUNK];
size_t nRead;
@tripulse
tripulse / File.js
Last active September 20, 2020 08:53
Short robust library overlies on fs module.
const fs = require("fs");
const path = require("path");
let file = {
pipes: [],
/**
* Adds new file into pipes as objects which could be later acessed.
* @param {String} file - Filename to read a specific file.
* @param {String | Number} mode - Options that how the Interpreter will load the file.
*/
@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==