Skip to content

Instantly share code, notes, and snippets.

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

Pratyay Banerjee Neilblaze

╰( ▀ ͜͞ʖ▀)つ──☆*:・゚ Hacking 👨‍💻
View GitHub Profile
// Demo ~ © Rachit Jain Bhaiya
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
@Neilblaze
Neilblaze / test_mail.js
Created July 28, 2020 21:33
Cross appX mail-sender via nodemailer (Test v1.0.1)
const nodemailer = require('nodemailer');
//Package that enables sending of emails in Javascript
//After performing npm init, npm install nodemailer must be perfomed, in order to obtain all the modules
let login_and_auth = nodemailer.createTransport({
service: 'gmail',
//Any email service can be used here
auth: {
user: 'sender',
pass: '******'
@Neilblaze
Neilblaze / generator.py
Created July 28, 2020 21:36
Filler text auto-.py
# pip install lorem_text
# import the lorem module from lorem_text
from lorem_text import lorem
# Provide the number of paragrpahs you want
paragraph_length = int(input("Enter the length of paragraph you want: "))
# Store it in a variable, lorem.paragraphs() is used to generate the paragraphs
se = lorem.paragraphs(paragraph_length)
@Neilblaze
Neilblaze / exec.py
Created July 28, 2020 21:39
Encrpytx_TEXT => Hash a string using a multitude of hashing Algorithms
import hashlib
import argparse
def main(text, hashType):
encoder = text.encode('utf_8')
myHash = ''
if hashType.lower() == 'md5':
myHash = hashlib.md5(encoder).hexdigest()
@Neilblaze
Neilblaze / serv.rb
Created July 29, 2020 11:48
Web server for browsing local files on the system through web browser -@Ruby_server - Exec `ruby server.rb`
require 'webrick'
server = WEBrick::HTTPServer.new(:Port=>5000,:DocumentRoot=>Dir::home())
trap("INT"){ server.shutdown }
server.start
@Neilblaze
Neilblaze / heatmap.js
Created July 30, 2020 13:34
Heatmap graffiti creating extension
const writeString = 'NEEL<3';
const colorSet = ['#2a6127', '#2a6127', '#7bc96f', '#c6e48b', '#ebedf0'];
const hearColors = ['rgba(255, 0, 0, 1)', 'rgba(255, 0, 0, 0.5)', 'rgba(255, 0, 0, 0.2)', 'rgba(255, 0, 0, 0.7)']
let days = document.getElementsByClassName("day")
for(day of days) {
day.setAttribute("fill", colorSet[4])
}
@Neilblaze
Neilblaze / gist:9c44da2a92981d6e6ee0951ecf269476
Created August 4, 2020 06:06 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@Neilblaze
Neilblaze / cluster.js
Created August 6, 2020 10:08
NCM load-balancer // archived
const cluster = require('cluster')
const os = require('os')
if (cluster.isMaster) {
const cpus = os.cpus().length
console.log(`Forking for ${cpus} CPUs`)
for (let i = 0; i < cpus; i++) {
cluster.fork()
}
@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.