Skip to content

Instantly share code, notes, and snippets.

Avatar
✌️
Peace

Rousan Ali rousan

✌️
Peace
View GitHub Profile
@rousan
rousan / app.md
Last active Sep 29, 2020
Solution: sum(1)(2)(3)(10)() = 16
View app.md

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
rousan / nginxproxy.md
Created Jul 26, 2020 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?
View nginxproxy.md

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 example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

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

@rousan
rousan / Steps.md
Created Jul 25, 2020
Install Nginx and Let's Encrypt on fresh VPS
View Steps.md
@rousan
rousan / README.txt
Last active Jun 2, 2020
Algorithms to solve a 3x3 rubiks cube
View README.txt
Rubiks Cube
Algorithms:
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
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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<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
rousan / cloudSettings
Last active Jan 13, 2021
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2021-01-13T16:44:16.049Z","extensionVersion":"v3.4.3"}
@rousan
rousan / Delete bulk users from mixpanel.md
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 mixpanel.md
  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 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) {
return;
}
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;
btn.click();
const allTracks = [...parent.querySelectorAll(".track-list-subtitles li.track")];
const englishTrack = allTracks.find(track => track.textContent.toLowerCase().includes("english"));
if (!englishTrack) {