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 / 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 / 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"}
<!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 / script-export.js
Last active March 2, 2020 10:05
Scripts to import/export slack messages from/to a conversation or a channel
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;
@rousan
rousan / README.md
Last active July 17, 2021 14:31
Algorithms to solve a 3x3 rubiks cube

Algorithms to solve a 3x3 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

Install Nginx and Let's Encrypt on fresh VPS

/etc/systemd/system/neo.service

  • After creating a fresh VPS instance, Run:
$ sudo apt-get update && apt-get upgrade
@rousan
rousan / nginxproxy.md
Created July 26, 2020 10:12 — forked from soheilhy/nginxproxy.md
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 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 / app.md
Last active September 29, 2020 03:19
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
rousan / README.md
Created July 17, 2021 14:29
How to add .service file in Ubuntu?

How to add .service file in Ubuntu?

  1. Write the my-server.service file name with the following content:
[Unit]
Description=Some description about the app.

[Service]
User=www-data

How to execute the .bashrc file with command running through SSH login?

I wanted to use command

ssh myhost.com 'some_command' and some_command exists in /var/some_location so I tried to append /var/some_location in $PATH environment by editing $HOME/.bashrc

but that wasn't working. because default .bashrc(Ubuntu 10.4 LTS) prevent from sourcing by code like below:

# If not running interactively, don't do anything