Skip to content

Instantly share code, notes, and snippets.

View rousan's full-sized avatar
:shipit:
Building products

Rousan Ali rousan

:shipit:
Building products
View GitHub Profile
@rousan
rousan / cloudSettings
Last active January 17, 2022 19:16
Visual Studio Code Settings Sync Gist
{"lastUpload":"2022-01-17T19:15:58.179Z","extensionVersion":"v3.4.3"}
@rousan
rousan / Delete bulk users from mixpanel.md
Last active November 15, 2019 13:38
This script will delete any profile that hasn't been seen since January 1st, 2019.
  1. Step 1:
pip install mixpanel-api
  1. Step 2:

This script will delete any profile that hasn't been seen since January 1st, 2019.

@rousan
rousan / inject_script_netflix_subtitle_keyboard_shortcut.js
Last active January 8, 2022 10:57
Netflix doesn't provide any keyboard shortcut to toggle English subtitle, so inject the following script to enable that feature. Keyboard Shortcut: Ctrl + S
document.addEventListener("keypress", (evt) => {
if (evt.ctrlKey && evt.keyCode === 19) {
console.log("Subtitle shortcut triggered");
const btn = document.querySelector(".button-nfplayerSubtitles");
if (!btn) {
return;
}
const parent = btn.parentElement;
document.addEventListener("keypress", (evt) => {
if (evt.ctrlKey && evt.keyCode === 19) {
const btn = document.querySelector(".button-nfplayerSubtitles");
const parent = btn.parentElement;
btn.click();
const allTracks = [...parent.querySelectorAll(".track-list-subtitles li.track")];
const englishTrack = allTracks.find(track => track.textContent.toLowerCase().includes("english"));
if (!englishTrack) {
@rousan
rousan / bal
Last active December 19, 2018 12:59
~/.aws/config
[default]
output = json
region = us-west-2
@rousan
rousan / file.js
Created December 3, 2018 12:37
Stack using Queue
class Stack {
constructor() {
this._queue = new Queue();
this._size = 0;
}
push(val) {
this._queue.enqueue(val)
}
@rousan
rousan / app.md
Created July 10, 2018 12:58
SSH Tunneling: Infinity Loop of Request

SSH Remote Server

To open remote forwarded port as public, append GatewayPorts yes config to ssd config file:

/etc/ssh/sshd_config

SSH Client

Run the following commands to get infinity loop in request:

@rousan
rousan / main.go
Created May 3, 2018 11:08
Execution order of Post Increment and Pre Increment operators
package main
func increment(x *int) {
*x = *x + 1
}
func main() {
x := 0
// Execution order of Post Increment operator
@rousan
rousan / README.md
Last active April 8, 2018 06:38
How ServeMux works in Golang http route multiplexing

How Does ServeMux Work in Golang?

Types of Route Pattern

There are two types of pattern registered:

  • Fixed named pattern (without trailing slash e.g. /about, /home)

  • Rooted path or subtree (with trailing slash e.g. /, /about/)

@rousan
rousan / evaluation-order.md
Last active June 4, 2018 21:25
Evaluation order of assignment operator in GoLang

Evaluation order of assignment operator in GoLang

In GoLang, the evaluation order of assignment operator is straight forward.

The order is:

  1. Evaluate the lvalues to Memory Location from left to right.
  2. Evaluate the rvalues to constant values from left to right.
  3. And finallly, assign rvalues to lvalues from left to right.

The POC: