Skip to content

Instantly share code, notes, and snippets.

View abrar71's full-sized avatar
🤑
Stealth Startup

Abrar Ahmed abrar71

🤑
Stealth Startup
View GitHub Profile
#!/bin/bash
# https://github.com/markus-perl/ffmpeg-build-script
# https://github.com/rdp/ffmpeg-windows-build-helpers
# https://github.com/zimbatm/ffmpeg-static
# https://github.com/m-ab-s/media-autobuild_suite
PROGNAME=$(basename "$0")
FFMPEG_VERSION=6.0
SCRIPT_VERSION=1.45
@abrar71
abrar71 / app.js
Created June 21, 2022 13:29
Microsecond timestamp to ISO String using Javascript/Node.js
let microTs = 1655816311710217;
let isoString = new Date(microTs/1e3).toISOString().slice(0, -4)+String(microTs).slice(-6).padStart(6, '0') + 'Z';
console.log(isoString)
microTs = 500;
console.log(new Date(microTs/1e3).toISOString().slice(0, -4)+String(microTs).slice(-6).padStart(6, '0') + 'Z')
microTs = 5000;
console.log(new Date(microTs/1e3).toISOString().slice(0, -4)+String(microTs).slice(-6).padStart(6, '0') + 'Z')
@abrar71
abrar71 / genKeyPair.js
Last active June 26, 2022 17:33
Generate Wireguard Keys using Node.js crypto
const crypto = require("crypto");
const genKeyPair = () => {
let keyPair = crypto.generateKeyPairSync("x25519", {
publicKeyEncoding: { format: "der", type: "spki" },
privateKeyEncoding: { format: "der", type: "pkcs8" }
});
return {
publicKey: keyPair.publicKey.slice(12).toString("base64"),
@abrar71
abrar71 / install.sh
Created June 21, 2021 18:20
Install rclone stable version from Github
#!/usr/bin/env bash
# error codes
# 0 - exited without problems
# 1 - parameters not supported were used or some unexpected error occurred
# 2 - OS not supported by this script
# 3 - installed version of rclone is up to date
# 4 - supported unzip tools are not available
set -e
@abrar71
abrar71 / lang.js
Created January 21, 2021 20:33 — forked from mirontoli/lang.js
Get Language name based on iso 639-1 code
/**
* @author Anatoly Mironov (mirontoli)
* http://sharepointkunskap.wordpress.com
* http://www.bool.se
*
* http://stackoverflow.com/questions/3605495/generate-a-list-of-localized-language-names-with-links-to-google-translate/14800384#14800384
* http://stackoverflow.com/questions/10997128/language-name-from-iso-639-1-code-in-javascript/14800499#14800499
*
* using Phil Teare's answer on stackoverflow
* http://stackoverflow.com/questions/3217492/list-of-language-codes-in-yaml-or-json/4900304#4900304
@abrar71
abrar71 / WireGuard-site-to-site.md
Created January 14, 2021 01:27
Accessing a subnet that is behind a WireGuard client using a site-to-site setup

WireGuard Site-to-Site

Accessing a subnet that is behind a WireGuard client using a site-to-site setup

Problem Summary

We want to access a local subnet remotely, but it is behind a NAT firewall and we can't setup port forwarding. Outgoing connections work, but all incoming connections get DROPPED by the ISP's routing policy.

Solution Summary

#!/bin/bash
# HOMEPAGE: https://github.com/markus-perl/ffmpeg-build-script
# LICENSE: https://github.com/markus-perl/ffmpeg-build-script/blob/master/LICENSE
PROGNAME=$(basename "$0")
VERSION=1.21
CWD=$(pwd)
PACKAGES="$CWD/packages"
WORKSPACE="$CWD/workspace"
@abrar71
abrar71 / crypto-aes-gcm.js
Created November 16, 2020 17:26 — forked from chrisveness/crypto-aes-gcm.js
Uses the SubtleCrypto interface of the Web Cryptography API to encrypt and decrypt text using AES-GCM (AES Galois counter mode).
/**
* Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt().
* (c) Chris Veness MIT Licence
*
* @param {String} plaintext - Plaintext to be encrypted.
* @param {String} password - Password to use to encrypt plaintext.
* @returns {String} Encrypted ciphertext.
*
* @example
* const ciphertext = await aesGcmEncrypt('my secret text', 'pw');
@abrar71
abrar71 / app.go
Created August 23, 2020 17:06
fasthttp write body and throttle 2 bytes per second
package main
import (
"bufio"
"io"
"net/http"
"time"
"github.com/valyala/fasthttp"
)
@abrar71
abrar71 / ffmpeg_build.sh
Created December 18, 2019 12:54
FFmpeg stable
#!/bin/bash
VERSION=1.7
CWD=$(pwd)
PACKAGES="$CWD/packages"
WORKSPACE="$CWD/workspace"
CC=clang
LDFLAGS="-L${WORKSPACE}/lib -lm"
CFLAGS="-I${WORKSPACE}/include"