Skip to content

Instantly share code, notes, and snippets.

View arnabsen1729's full-sized avatar
🏠
Working from home

Arnab Sen arnabsen1729

🏠
Working from home
View GitHub Profile
@arnabsen1729
arnabsen1729 / psql_cheatsheet.md
Created June 19, 2020 09:14
PostgresSQL Cheatsheet

PostgreSQL

Installation

Installation Process

NOTE: Make sure you add bin to the path for you to be able to run the command.

Starting a postgres db

$ sudo service postgress start

@arnabsen1729
arnabsen1729 / c++.sublime-build
Created November 22, 2020 01:58
My C++ sublime build config for CP
{
"cmd": ["g++", "-std=c++17", "-Wextra", "-Wshadow", "-Wall", "-DLOCAL_MACHINE", "-fsanitize=undefined", "$file", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++, source.cxx, source.cpp",
"variants":
[
{
"name": "Run",
"shell": true,
@arnabsen1729
arnabsen1729 / gzip_compression.py
Created January 3, 2021 07:35
Compression using Gzip
import base64
import zlib
def b64encode(data):
encoded = base64.encodebytes(data)
return encoded
def b64decode(data, filename):
decoded = base64.decodebytes(data)
image = open(filename, 'wb')
@arnabsen1729
arnabsen1729 / app.py
Created January 3, 2021 14:34
Sample Flask app
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "hello world!"
if __name__ == "__main__":
app.run(host="0.0.0.0")
@arnabsen1729
arnabsen1729 / mongo-docker-compose.yml
Created February 20, 2021 13:35
Docker Compose for MongoDB along with Mongo-Express with Root and Admin Auth, data persistent on docker.
version: <version>
services:
mongodb:
image: mongo
container_name: mongodb
environment:
- MONGO_INITDB_ROOT_USERNAME=<root>
- MONGO_INITDB_ROOT_PASSWORD=<root_pass>
volumes:
#include <bits/stdc++.h>
using namespace std;
void insertBucket(vector<vector<float>> &buckets, float value, int n) {
int index = n * value;
buckets[index].push_back(value);
sort(buckets[index].begin(), buckets[index].end());
}
void bucketSort(vector<float> &arr, vector<vector<float>> &buckets, int n,
@arnabsen1729
arnabsen1729 / tablet_hotkeys.sh
Created June 8, 2021 11:58
Scrip to assign shortcut keys to my H950P Huion tablet
#!/bin/bash
PAD_NAME=$(xsetwacom --list devices | grep pad | cut -f 1 | awk '{$1=$1;print}')
xsetwacom --set "${PAD_NAME}" Button 1 "key +ctrl +c -c -ctrl"
xsetwacom --set "${PAD_NAME}" Button 2 "key +ctrl +v -v -ctrl"
xsetwacom --set "${PAD_NAME}" Button 3 "key +ctrl +z -z -ctrl"
xsetwacom --set "${PAD_NAME}" Button 8 "key +ctrl +a -a -ctrl"
xsetwacom --set "${PAD_NAME}" Button 9 "key +BackSpace -BackSpace"
xsetwacom --set "${PAD_NAME}" Button 11 "key +ctrl + -ctrl"
xsetwacom --set "${PAD_NAME}" Button 12 "key +ctrl - -ctrl"
@arnabsen1729
arnabsen1729 / install-nvm.md
Last active September 25, 2021 09:51
Installing nvm and the latest Node JS

nvm is a version manager for node.js, It helps to easily switch between various versions of node very easily.

Install nvm and node

Windows

Follow the steps here.

Linux/Mac

@arnabsen1729
arnabsen1729 / Dockerfile
Created October 27, 2021 15:46
Dockerfile for Docker and Container Session
FROM node:alpine
COPY . /app
WORKDIR /app
RUN npm install
CMD ["npm", "start"]