Skip to content

Instantly share code, notes, and snippets.

@mavvverick
mavvverick / System Design.md
Created April 12, 2021 19:24 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@mavvverick
mavvverick / read-access.sql
Created February 7, 2021 17:35 — forked from oinopion/read-access.sql
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@mavvverick
mavvverick / insert_pg.go
Created October 29, 2020 15:42 — forked from reterVision/insert_pg.go
A trivial program that uses goroutine to insert records into Postgres.
/*
Original idea from
http://www.acloudtree.com/how-to-shove-data-into-postgres-using-goroutinesgophers-and-golang/
*/
package main
import (
"log"
"time"
"os"
@mavvverick
mavvverick / github_labels.json
Created August 7, 2020 10:22
Style guide for org-labels
[
{
"name": "Status: Abandoned",
"color": "000000"
},
{
"name": "Status: Accepted",
"color": "009800"
},
{
# -*-coding:utf-8-*-
import numpy as np
from PIL import Image
import sys
import json
import requests
import glob
_IMAGE_SIZE = 299
SERVER_URL = 'http://localhost:8501/v1/models/nsfw:predict'
@mavvverick
mavvverick / labels.sh
Last active April 6, 2022 17:56
Add sane labels to GitHub Repo
USER={{user}} or {{organisation}}
TOKEN={{token}}
REPO={{repo}}
#Delete default labels
curl --user "$USER:$TOKEN" --include --request DELETE "https://api.github.com/repos/$USER/$REPO/labels/bug"
curl --user "$USER:$TOKEN" --include --request DELETE "https://api.github.com/repos/$USER/$REPO/labels/duplicate"
curl --user "$USER:$TOKEN" --include --request DELETE "https://api.github.com/repos/$USER/$REPO/labels/enhancement"
curl --user "$USER:$TOKEN" --include --request DELETE "https://api.github.com/repos/$USER/$REPO/labels/invalid"
curl --user "$USER:$TOKEN" --include --request DELETE "https://api.github.com/repos/$USER/$REPO/labels/question"
@mavvverick
mavvverick / story.txt
Created December 1, 2019 13:31
Agile story Gist
Story Phases
Design
====> Mobile ====> Review (stake holder (Backend / Design)) =====> User
Backend
1. Phase must be decided based on delivery output
2. if UI/UX is the output
As a mobile engineeer I want profile deisgn so that I can integrate in app
## Create temproray table by picking min duplicate id and delete
delete table from table inner join
(select min(id) minid, sample_data, sample_data1, sample_data2
from table
group by ssample_data, sample_data1
having count(1) > 1) as duplicates
on (duplicates.minid = search_search.id)
## Keep only duplicate entry and delete rest