Skip to content

Instantly share code, notes, and snippets.

View Neilblaze's full-sized avatar
╰( ▀ ͜͞ʖ▀)つ──☆*:・゚ Hacking 👨‍💻

Pratyay Banerjee Neilblaze

╰( ▀ ͜͞ʖ▀)つ──☆*:・゚ Hacking 👨‍💻
View GitHub Profile
@Neilblaze
Neilblaze / SQLite.md
Created August 6, 2020 20:31
SQLite - in-memory cache

SQLite is a self-contained, high-reliability, embedded, full-featured, public-domain, SQL database engine. It is super easy to install and use it in the code. Here I am going to cover how to use SQLite as an in-memory cache. Often times, we might have some metadata like zipcodes/citycodes mapping which are couple MBs in size. It might be an overkill to create a database and maintain them separately if they are not going to change. For those kind of scenarios my goto solution is SQLite which can be used to easily load CSV files as tables. It is super fast to access those data since they are in memory. If you are using docker, then you don’t even need to worry about cleaning/recreating DB files used by SQLite.

Below are some generic methods I would like to go through.

  • Creating table from CSV
  • Get values for a column, filter value.
import gzip
import os
@Neilblaze
Neilblaze / DR.md
Created August 6, 2020 20:37
ENGINEERING BEST PRACTICE ~ Design reviews

Design reviews are a nice process to get feedback from other engineers in the company when designing a new system/feature. It is a learning opportunity for the designer and a good collaboration method to design better systems using the expertise of senior folks in the company. I would like to explain the process we follow at WP when developing a new feature or system. These are three components to the design review.

  • Writing a design document.
  • Sharing the document and receiving feedback.
  • Schedule a meeting and go over the design for any flaws/improvements.

Writing design document: The engineer who is writing the document should be thoughtful about explaining the product specification and full feature design details so that other engineers who may not be aware of the complete system would still be able to get a full picture and be able to provide feedback on the design.

Below are some basic components that has to be covered in the document.

@Neilblaze
Neilblaze / travis.yml
Last active August 9, 2020 21:24
Travis CI tests // Archived
language: node_js
node_js:
- "node"
///////////// [ HEROKU ⬇️ ] \\\\\\\\\\\\\
language: node_js
node_js:
- "11.10.1"
deploy:
@Neilblaze
Neilblaze / spawny.py
Created August 23, 2020 15:37
Spawny - Spawns a terminal in the area where you drag your mouse
# Spawny - Spawns a terminal in the area where you drag your mouse
import subprocess
import os
# alt + mouse drag
p = subprocess.Popen("xinput test-xi2 --root", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, bufsize=1)
event = []
@Neilblaze
Neilblaze / instascrap.js
Created August 23, 2020 21:37
Scrap Instagram at scoop!
const puppeteer = require('puppeteer');
async function scrapeIG(url) {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto(url);
const [e1] = await page.$x('//*[@id="react-root"]/section/main/div/header/section/div[1]/h2');
const txt1 = await e1.getProperty('textContent');
const username = await txt1.jsonValue();
@Neilblaze
Neilblaze / stuns
Created September 16, 2020 10:22 — forked from yetithefoot/stuns
STUN+TURN servers list
{url:'stun:stun01.sipphone.com'},
{url:'stun:stun.ekiga.net'},
{url:'stun:stun.fwdnet.net'},
{url:'stun:stun.ideasip.com'},
{url:'stun:stun.iptel.org'},
{url:'stun:stun.rixtelecom.se'},
{url:'stun:stun.schlund.de'},
{url:'stun:stun.l.google.com:19302'},
{url:'stun:stun1.l.google.com:19302'},
{url:'stun:stun2.l.google.com:19302'},
@Neilblaze
Neilblaze / .gitattributes
Created September 30, 2020 17:36
Hand Gesture Mouse Controller
# Auto detect text files and perform LF normalization
* text=auto
@Neilblaze
Neilblaze / SD.md
Last active June 6, 2024 18:24
Standard System Design Interview Approach Template
@Neilblaze
Neilblaze / scrapy.md
Created June 24, 2021 21:09 — forked from bradtraversy/scrapy.md
Scrapy commands and code
@Neilblaze
Neilblaze / node_nginx_ssl.md
Created June 24, 2021 21:10 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user