Skip to content

Instantly share code, notes, and snippets.

View kshitij10496's full-sized avatar

Kshitij Saraogi kshitij10496

View GitHub Profile
@kshitij10496
kshitij10496 / osdesign.c
Created January 31, 2018 09:11
OSDesign
#include<stdio.h>
#include<string.h>
#include<time.h>
int main() {
char x[20];
int a[200];
do {
scanf("%s", x);
@kshitij10496
kshitij10496 / logging.md
Created May 30, 2018 17:20
Logging in Go

Printing log message and/or writing log libraries is relatively easy, maintaining the logging infrastructure is a complex task.

What should we log?

  • Everything which is essential to understand our application's behaviour.
  • Logging can be a bottleneck to performance-centric APIs.

Guideline

  • Use log.Criticalf explicitly in the business logic layer only.
  • Use log.Debugf in the controllers/handlers whenever you want to.
@kshitij10496
kshitij10496 / SketchSystems.spec
Created June 9, 2018 11:59
My Awesome Sketch
My Awesome Sketch
First State
some event -> Second State
Second State
@kshitij10496
kshitij10496 / deploy.sh
Last active September 11, 2018 13:42
Shell script for deploying Hugo blog to GitHub
#!/bin/sh
hugo
cd public
git add .
git commit -m "$1"
git push origin master
@kshitij10496
kshitij10496 / config.toml
Created September 11, 2018 18:11
Simple Hugo configuration file
# Hostname (and path) to the root.
baseURL = "https://<your-github-username>.github.io/"
# The site’s language code used to generate RSS.
languageCode = "en"
# Theme to use (located by default in /themes/THEMENAME/).
theme = "<your-theme-name>"
# Site title.
@kshitij10496
kshitij10496 / authors.sh
Created October 23, 2018 20:32
Shell command to create a list of all the authors of a Git repository
# You can add this to your Makefile to make it easy to update authors.
# Let's be thankful to the community and show our gratitude. :D
git log --pretty="%an <%ae>" | sort | uniq >> AUTHORS
@kshitij10496
kshitij10496 / docker-compose.yml
Created January 17, 2019 15:03
Postgres with Docker example
version: '3'
services:
postgres:
image: postgres:11.1-alpine
container_name: "shadowsDB"
environment:
- POSTGRES_USER="batman"
- POSTGRES_PASSWORD="blueflower"
- POSTGRES_DB="league_of_shadows"
@kshitij10496
kshitij10496 / 1.sql
Created January 17, 2019 15:51
[Postgres with Docker] Table Creation SQL
CREATE TABLE IF NOT EXISTS members (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
bio TEXT
);
@kshitij10496
kshitij10496 / 2.sql
Created January 17, 2019 15:52
[Postgres with Docker] Table Insertion SQL
INSERT INTO members (name, bio) VALUES (E'Ra\'s al Ghul', E'He is the founder of The League of Shadows.');
INSERT INTO members (name, bio) VALUES ('Bruce Wayne', E'Batman\'s secret identity is Bruce Wayne, an American billionaire, playboy, philanthropist, and owner of Wayne Enterprises.');
INSERT INTO members (name, bio) VALUES ('Talia al Ghul', E'She is the daughter of Ra\'s al Ghul.');
INSERT INTO members (name, bio) VALUES ('Bane', E'Bane was once a member of The League until he was excommunicated by Ra\'s al Ghul.');
@kshitij10496
kshitij10496 / docker-compose.yml
Created January 17, 2019 15:58
[Postgres with Docker]: Loading data into DB
version: '3'
services:
postgres:
image: postgres:11.1-alpine
container_name: shadowsDB
environment:
POSTGRES_DB: "league_of_shadows"
POSTGRES_USER: "batman"
POSTGRES_PASSWORD: "blueflower"