Skip to content

Instantly share code, notes, and snippets.

View arafathusayn's full-sized avatar
👨‍💻
Focusing

Arafat Husayn arafathusayn

👨‍💻
Focusing
View GitHub Profile
@arafathusayn
arafathusayn / make-encrypted-hls-vod.sh
Last active May 13, 2022 20:59
Bash script to create AES-encrypted HLS VOD using ffmpeg. Usage: ./make-encrypted-hls-vod.sh <path to video file>
#!/bin/bash
openssl rand 16 > enc.key
printf "enc.key\nenc.key\n$(openssl rand -hex 16)" > enc.keyinfo
mkdir -p ./hls
ffmpeg -y \
-i "$1" \
@arafathusayn
arafathusayn / query.sql
Created March 2, 2020 11:47
Fix phpmyadmin cannot access root
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '<YOUR PASSWORD>';
@arafathusayn
arafathusayn / auto-remove-page-invites-on-facebook.js
Last active November 3, 2022 09:29
[New Theme Supported] Automatically Decline All Page Invites on Facebook
var main = async () => {
let response = await fetch("https://www.facebook.com/pages/?category=invites")
response = await response.text()
let matches = response.match(/"compat_iframe_token":"(.+?)"/gi)
const iframeToken = matches[0].replace(`compat_iframe_token":"`, "").replace(/\"/g, "")
response = await fetch(`https://www.facebook.com/pages/?category=invites&cquick=jsc_c_p&cquick_token=${iframeToken}&ctarget=https%3A%2F%2Fwww.facebook.com`)
response = await response.text()
@arafathusayn
arafathusayn / default.conf
Created September 12, 2019 09:31
Deny direct IP address access on port 80 using Nginx
server {
listen 80 default_server;
server_name _; # some invalid name that won't match anything
return 444;
}
server {
listen 80;
index index.php index.html;
root /var/www/public;
@arafathusayn
arafathusayn / make_qr.sh
Created August 23, 2019 20:55
Binary file to multiple QR code image generation and validation (dependencies: qrencode & zbarimg). It takes one file name as the first command-line argument. Second argument is optional which sets how many characters you need to embed in each QR image (default: 1000).
#!/bin/bash
input_file_name="$1"
base64_file_name="__out.b64"
dir="_qr"
mkdir -p $dir
max_length=${2:-1000}
@arafathusayn
arafathusayn / get_node_modules.js
Created July 4, 2019 12:51
Get all node_modules/npm package names from webpage if published (eg. Trello)
main = async (url) => {
let el = document.createElement('div')
el.innerHTML = await fetch(url).then(res => res.text())
const scripts = el.querySelectorAll('script')
const scriptCodes = await Promise.all(Array.from(scripts).filter(script => script.src).map(script => script.src).map(async url => {
const code = await fetch(url).then(res => res.text()).catch(e => null)
return code
@arafathusayn
arafathusayn / noscript-tracking.go
Created May 28, 2019 09:01 — forked from wybiral/noscript-tracking.go
Tracking cursor position in real-time with remote monitoring (without JavaScript)
// Tracking cursor position in real-time without JavaScript
// Demo: https://twitter.com/davywtf/status/1124146339259002881
package main
import (
"fmt"
"net/http"
"strings"
)
@arafathusayn
arafathusayn / WebGL-frameworks-libraries.md
Created February 24, 2019 14:16 — forked from dmnsgn/WebGL-WebGPU-frameworks-libraries.md
A collection of WebGL frameworks and libraries

A non-exhaustive list of WebGL frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are outdated/not maintained anymore.

Engines and libraries

  • three.js: JavaScript 3D library
  • stack.gl: an open software ecosystem for WebGL, built on top of browserify and npm.
  • PixiJS: Super fast HTML 5 2D rendering engine that uses webGL with canvas fallback
  • Pex: Pex is a javascript 3d library / engine allowing for seamless development between Plask and WebGL in the browser.
  • Babylon.js: a complete JavaScript framework for building 3D games with HTML 5 and WebGL
  • AwayJS: AwayJS is a graphics library for javascript written in typescript
  • SceneJS: An extensible WebGL-based engine for high-detail 3D visualisation
@arafathusayn
arafathusayn / pdf_to_png.js
Created February 13, 2019 10:01
PDF to PNG
(function() {
function main() {
var pages = [], heights = [], width = 0, height = 0, currentPage = 1;
var scale = 1.5;
function draw() {
var canvas = document.createElement('canvas'), ctx = canvas.getContext('2d');
canvas.width = width;
canvas.height = height;
@arafathusayn
arafathusayn / device-names-installs.js
Created January 14, 2019 12:36
From Google Play Console, this script will get the name list of the active device models and the number of installs for each in JSON format in clipboard
/*
* Instructions:
* Go to "Google Play Console" > "Statistics" > click on the dropdown beside "Select" and choose "Device" ...
* Then click "Add Device" and you can read the list of active devices and the number of installs ...
* After that, run the script in the browser console and you'll see a table after a while and the JSON data will be copied.
*/
const spans = document.querySelectorAll('[aria-label*="device :"]')
const data = []
let skipFirstOne = true