Skip to content

Instantly share code, notes, and snippets.

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

Gaurav Khare gauravkhare

🏠
Working from home
  • Bangalore, IND
View GitHub Profile
@vasanthk
vasanthk / System Design.md
Last active April 22, 2025 14:25
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?
@diegopacheco
diegopacheco / go-install.md
Last active August 12, 2019 19:40
How to Install GO Lang on CentOS / Amazon Linux?

How to Install GO Lang on CentOS / Amazon Linux?

sudo wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz
tar -xzf go1.4.2.linux-amd64.tar.gz 
export GOROOT=PATH_WHERE_YOU_EXTRACT_GO
export PATH=$PATH:$GOROOT/bin 
export GOBIN=$GOROOT/bin 
mkdir ~/golang/ 
export GOPATH=~/golang/ 
@yaroncon
yaroncon / KafkaConsumer.java
Last active June 12, 2020 08:03
Kafka consumer with Avro
import kafka.consumer.ConsumerConfig;
import kafka.consumer.ConsumerIterator;
import kafka.consumer.KafkaStream;
import kafka.javaapi.consumer.ConsumerConnector;
import kafka.message.MessageAndMetadata;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericDatumReader;
import org.apache.avro.generic.GenericRecord;
import org.apache.avro.io.Decoder;
import org.apache.avro.io.DecoderFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import org.apache.hadoop.io.IOUtils;
import java.io.IOException;
public class MyFileUtil {
public static boolean copyMergeWithHeader(FileSystem srcFS, Path srcDir, FileSystem dstFS, Path dstFile, boolean deleteSource, Configuration conf, String header) throws IOException {
dstFile = checkDest(srcDir.getName(), dstFS, dstFile, false);
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active April 21, 2025 10:43
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@ElectricCoffee
ElectricCoffee / SimpleHashGenerator.scala
Last active March 9, 2022 10:39
A very simple checksum generator written in scala, the following checksum types have been tested: MD2 MD5 SHA SHA-256 SHA-512
package your.pkg.here
import java.security.MessageDigest
import java.nio.file.{Files, Paths}
object Generator {
implicit class Helper(val sc: StringContext) extends AnyVal {
def md5(): String = generate("MD5", sc.parts(0))
def sha(): String = generate("SHA", sc.parts(0))
def sha256(): String = generate("SHA-256", sc.parts(0))
@romansklenar
romansklenar / crosstab.sql
Last active February 1, 2023 18:46
PostgreSQL "pivot table" example using tablefunc extension
CREATE EXTENSION tablefunc;
CREATE TABLE sales(year int, month int, qty int);
INSERT INTO sales VALUES(2007, 1, 1000);
INSERT INTO sales VALUES(2007, 2, 1500);
INSERT INTO sales VALUES(2007, 7, 500);
INSERT INTO sales VALUES(2007, 11, 1500);
INSERT INTO sales VALUES(2007, 12, 2000);
INSERT INTO sales VALUES(2008, 1, 1000);
INSERT INTO sales VALUES(2009, 5, 2500);
@dopa
dopa / gist:5245868
Created March 26, 2013 14:42
Shell Script to Back Up all MySQL Databases, Keep 7 Days of Backups
#!/bin/bash
# Script will output dumps for all databases using seperate files
# Derived from this post: http://www.cyberciti.biz/faq/ubuntu-linux-mysql-nas-ftp-backup-script/
USER="root"
PASSWORD="SnM1073k"
HOST="localhost"
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
OUTPUT_DIR="/backups/files"
@nathansmith
nathansmith / web-design-development-learning-resources.md
Last active October 12, 2024 17:08
Resources for learning web design & front-end development