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 / 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
@rousan
rousan / file.md
Last active November 21, 2022 22:12
Netcat command cheatsheet

Netcat cheatsheet

  • Netcat listening on port 567/TCP:
$ nc -l 567
  • Connecting to that port from another machine:
We can't make this file beautiful and searchable because it's too large.
Row ID,Order ID,Order Date,Ship Date,Ship Mode,Customer ID,Customer Name,Segment,Country/Region,City,State,Postal Code,Region,Product ID,Category,Sub-Category,Product Name,Sales,Quantity,Discount,Profit
1,CA-2019-152156,11/8/2019,11/11/2019,Second Class,CG-12520,Claire Gute,Consumer,United States,Henderson,Kentucky,42420,South,FUR-BO-10001798,Furniture,Bookcases,Bush Somerset Collection Bookcase,261.96,2,0,41.9136
2,CA-2019-152156,11/8/2019,11/11/2019,Second Class,CG-12520,Claire Gute,Consumer,United States,Henderson,Kentucky,42420,South,FUR-CH-10000454,Furniture,Chairs,"Hon Deluxe Fabric Upholstered Stacking Chairs, Rounded Back",731.94,3,0,219.582
3,CA-2019-138688,6/12/2019,6/16/2019,Second Class,DV-13045,Darrin Van Huff,Corporate,United States,Los Angeles,California,90036,West,OFF-LA-10000240,Office Supplies,Labels,Self-Adhesive Address Labels for Typewriters by Universal,14.62,2,0,6.8714
4,US-2018-108966,10/11/2018,10/18/2018,Standard Class,SO-20335,Sean O'Donnell,Consumer,United States,Fort Lauderdale,Fl
@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 / 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;
@rousan
rousan / CoinMarketCap Extra Actions.md
Last active December 4, 2021 06:49
It will add extra actions to CoinMarketCap.com website and it helps to view the coin information in same window.

CoinMarketCap Extra Actions

It will add extra actions to CoinMarketCap.com website and it helps to view the coin information in same window.

const EXTRA_ACTIONS_CLASSNAME = "coin-extra-actions";
const POPUP_CONTAINER_CLASSNAME = "coin-extra-popup-container";
const renderChanges = () => {
  const coinElems = document.querySelectorAll(".sc-16r8icm-0.escjiH");
  [...coinElems].forEach((coinElem) => {
    if (!coinElem.querySelector(`.${EXTRA_ACTIONS_CLASSNAME}`)) {

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
@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 / 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;