Skip to content

Instantly share code, notes, and snippets.

View abhi-jha's full-sized avatar

abhi-jha

View GitHub Profile
@krisleech
krisleech / renew-gpgkey.md
Last active May 20, 2024 08:24
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@vetom
vetom / avl.cpp
Last active February 24, 2019 00:49
C++ AVL Tree
#include <iostream>
#include <algorithm> // swap, sort, min, find, max
using namespace std;
class Node
{
int data;
Node* left;
Node* right;
int height;
@vasanthk
vasanthk / System Design.md
Last active May 24, 2024 06:19
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?
@Wunkolo
Wunkolo / compact.cpp
Last active May 5, 2024 20:21
Ascii Raymarcher(old)
#include <math.h>
#include <algorithm>
#include <string>
#include <immintrin.h>
using namespace std;typedef float R;
#define _W 79
#define _H 39
#define EP 0.01f
#define OP operator
#define C const
@karpathy
karpathy / min-char-rnn.py
Last active May 22, 2024 08:28
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@dutc
dutc / py₃.so₂.py
Last active April 3, 2020 01:51
py₃.so₂ example
#!/usr/bin/env python3
from cffi import FFI
from textwrap import dedent
from os import getpid
from sys import version_info
if __name__ == '__main__':
from sys import argv
print('Host is: %s (%s)' % (version_info, getpid()))
@GABeech
GABeech / haproxy.cfg
Created August 21, 2014 18:35
Stack Exchange HAProxy
# This is an example of the Stack Exchange Tier 1 HAProxy config
# The only things that have been changed from what we are running are:
# 1. User names have been removed
# 2. All Passwords have been remove
# 3. IPs have been changed to use the example/documentation ranges
# 4. Rate limit numbers have been changed to randome numbers, don't read into them
userlist stats-auth
group admin users $admin_user
user $admin_user insecure-password $some_password
@velicast
velicast / stdc++.h
Created July 17, 2013 17:56
Linux GCC 4.8.0 /bits/stdc++.h header definition.
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
@xorpaul
xorpaul / open-adressing.py
Created September 14, 2012 20:56
python dict open adressing hashtable
import sys
class HashTable:
def __init__(self):
self.fill = 8 # Active + # Dummy
self.list = [0] * self.fill
self.used = 0 # Active
def __getitem__(self, slot):
return self.list[slot]
def insert(self, slot, key):
@naryad
naryad / CreateTwitterTable.java
Created July 23, 2011 11:09
Minimal implementation of twitter data layer using HBase
package hbase.sandbox;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.HBaseAdmin;