Skip to content

Instantly share code, notes, and snippets.

View fa7ad's full-sized avatar

Fahad Hossain fa7ad

View GitHub Profile
@fa7ad
fa7ad / yt-loudness.user.js
Last active April 24, 2024 11:04 — forked from WouterG/tampermonkey-script.js
Disable youtube volume normalization (allow true video 100% volume)
// ==UserScript==
// @name YouTube Disable Normalization
// @namespace https://gist.github.com/fa7ad/fa995474f5cb9fe91fb209686881373d
// @version 0.2
// @description Allows true 100% volume on youtube videos.
// @author Wouter Gerarts
// @match https://www.youtube.com/*
// @match https://youtube.com/*
// @grant none
// ==/UserScript==
@fa7ad
fa7ad / buergerbot.rb
Created November 7, 2022 13:02 — forked from xuio/buergerbot.rb
Bürgerbot: Refreshes the Berlin Bürgeramt page until an appointment becomes available, then notifies you via Telegram
#!/usr/bin/env ruby
require 'watir-webdriver'
require 'telegram/bot'
Telegram.bots_config = {
default: '<Telegram Bot token>',
}
Telegram.bot.get_updates
https://www.github.developerdan.com/hosts/lists/ads-and-tracking-extended.txt
@fa7ad
fa7ad / mpvc.sh
Created March 30, 2020 14:07
Cast Youtube to MPV
#!/bin/sh
#
# fyr - 2019 (c) MIT | /bin/sh mpvc
# control mpv remotely using JSON ipc
# https://mpv.io/manual/master/#json-ipc
SOCKET=${MPVC_SOCKET:-/tmp/mpvsocket}
MPVOPTIONS="--no-audio-display"
usage() {
@fa7ad
fa7ad / example_filter_1.js
Created February 7, 2020 14:33
transducer__medium
const data = ['apple', 'banana', 'orange', 'strawberry']
const isNotBerry = fruit => !/berry/i.test(fruit)
const fruitsThatArentBerries = data.filter(capitalizeFirst)
function add(a, b) {
let c = 0;
let n = a.length > b.length ? a : b
let m = n === a ? b.padStart(a.length, 0) : a.padStart(b.length, 0)
let r = []
for(let i = n.length - 1;i >= 0; i--){
let s = c > 0 ? c-- : 0;
s += +n[i] + +m[i]
if (s > 9) c++
r.unshift((s%10)+"")
@fa7ad
fa7ad / countryToEmoji.js
Last active October 12, 2019 10:19
ISO Country code to Emoji Flag
function countryToEmoji (code) {
code = code.toUpperCase()
const [e1, e2] = [code.codePointAt(0) + 127397, code.codePointAt(1) + 127397]
return String.fromCodePoint(e1) + String.fromCodePoint(e2)
}
function countryToEmoji (code) {
code = code.toUpperCase()
const [e1, e2] = [code.codePointAt(0) + 127397, code.codePointAt(1) + 127397]
return String.fromCodePoint(e1) + String.fromCodePoint(e2)
}
import math
from random import randrange
from copy import deepcopy
class Puzzle:
def __init__(self):
self.board = [
[1, 2, 3],
[4, 5, 6],
@fa7ad
fa7ad / main.cc
Last active November 8, 2018 04:20
MatrixChainMult.cpp
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
using namespace std;
template <int T>
void multMatrix(array<array<int, T>, T> a, array<array<int, T>, T> b,
array<array<int, T>, T> &res) {
int i, j, k;