Skip to content

Instantly share code, notes, and snippets.


Rousan Ali rousan

View GitHub Profile
rousan /
Last active Sep 29, 2020
Solution: sum(1)(2)(3)(10)() = 16

Solution: sum(1)(2)(3)(10)() = 16

  1. Solution 1: Cache the value in the function itself. But, It will not work when the function is called multiple times at the same time.
function sumAggr(num) {
  if (sumAggr.sum === undefined) {
    sumAggr.sum = 0;
rousan /
Created Jul 26, 2020 — forked from soheilhy/
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for,, and on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

rousan /
Created Jul 25, 2020
Install Nginx and Let's Encrypt on fresh VPS
rousan / README.txt
Last active Jun 2, 2020
Algorithms to solve a 3x3 rubiks cube
View README.txt
Rubiks Cube
1. The Righty Alg: R U Ri Ui
2. The Lefty Alg: Li Ui L U
3. Spin Right: rotote whole cube by 90deg in closewise
4. Spin Left: rotote whole cube by 90deg in anti-closewise
1. White cross(Daisy -> complete
rousan / script-export.js
Last active Mar 2, 2020
Scripts to import/export slack messages from/to a conversation or a channel
View script-export.js
const fs = require("fs-extra");
const axios = require("axios");
const webhookUrl = "webhook_url_for_the_destination_conversation_or_channel_of_the_app_created_on_the_destination_slack_Workspace";
(async function () {
const messages = fs.readJSONSync('./messages.json');
for (const m of messages) {
// const { text } = m;
View Email Body HTML Sample
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "">
<html xmlns="" xmlns:o="urn:schemas-microsoft-com:office:office"
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="width=device-width" name="viewport" />
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
rousan / cloudSettings
Last active Jan 13, 2021
Visual Studio Code Settings Sync Gist
View cloudSettings
rousan / Delete bulk users from
Last active Nov 15, 2019
This script will delete any profile that hasn't been seen since January 1st, 2019.
View Delete bulk users from
  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 / inject_script_netflix_subtitle_keyboard_shortcut.js
Last active Nov 12, 2019
Netflix doesn't provide any keyboard shortcut to toggle English subtitle, so inject the following script to enable that feature. Keyboard Shortcut: Ctrl + S
View inject_script_netflix_subtitle_keyboard_shortcut.js
document.addEventListener("keypress", (evt) => {
if (evt.ctrlKey && evt.keyCode === 19) {
console.log("Subtitle shortcut triggered");
const btn = document.querySelector(".button-nfplayerSubtitles");
if (!btn) {
const parent = btn.parentElement;
View netflix_subtitle_shortcut.js
document.addEventListener("keypress", (evt) => {
if (evt.ctrlKey && evt.keyCode === 19) {
const btn = document.querySelector(".button-nfplayerSubtitles");
const parent = btn.parentElement;;
const allTracks = [...parent.querySelectorAll(".track-list-subtitles li.track")];
const englishTrack = allTracks.find(track => track.textContent.toLowerCase().includes("english"));
if (!englishTrack) {