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 / 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 / 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 / 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 / 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 / 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 / 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 / eslint_prettier_airbnb.md
Last active July 9, 2020 14:23 — forked from bradtraversy/eslint_prettier_airbnb.md
ESLint, Prettier & Airbnb Setup

VSCode - ESLint, Prettier, Airbnb & Custom Rules Setup

1. Install ESLint & Prettier extensions for VSCode

Optional - Set format on save and any global prettier options

2. Install Packages

npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
@arafathusayn
arafathusayn / Emoji-on-Ubuntu.md
Last active July 4, 2025 17:04
Guide to enable system-wide Emoji support on Ubuntu 🤩

1. Install Fonts

sudo apt install fonts-noto-color-emoji

2. Add Font Configuration

  • Open ~/.config/fontconfig/conf.d/01-emoji.conf file in an editor.
  • Copy-paste the lines below:
@arafathusayn
arafathusayn / worker.js
Last active September 6, 2020 10:40
Cloudflare Worker as Redirected URL Resolver
addEventListener("fetch", (event) => {
event.respondWith(handleRequest(event.request));
});
/**
* Respond to the request
* @param {Request} request
* @returns {Response}
*/
async function handleRequest(request) {
@arafathusayn
arafathusayn / apt-install-chrome-deps.sh
Created September 8, 2020 15:23
Chromium Linux Dependencies
sudo apt install -y ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils