Skip to content

Instantly share code, notes, and snippets.

View ninja-'s full-sized avatar

ninja ninja-

View GitHub Profile
@lukehoban
lukehoban / index.ts
Last active February 24, 2023 15:31
Simple Aurora Serverless + Lambda VPC example with Pulumi
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";
import * as random from "@pulumi/random";
// Construct a VPC
const vpc = new awsx.ec2.Vpc("vpc");
// Create an Aurora Serverless MySQL database
const dbsubnet = new aws.rds.SubnetGroup("dbsubnet", {
package de.zh32.slp;
import com.google.gson.Gson;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
@tipabu
tipabu / BalancedOrderStatisticTree.java
Last active March 13, 2024 06:48
Order statistic tree based on AVL trees. Insertion, removal, search, ranking, and selection will all be O(log(N)), as it's self-balancing. Supports duplicate elements, with each element inserted after smaller elements and elements of the same value but before larger elements. See also: http://en.wikipedia.org/wiki/Order_statistic_tree http://en.…
import java.util.Iterator;
import java.util.AbstractQueue;
import java.util.NoSuchElementException;
public class BalancedOrderStatisticTree<T extends Comparable<T>> extends AbstractQueue<T> {
/**
* Nodes of the tree.
*/
private class Node {
/**
@aras-p
aras-p / preprocessor_fun.h
Last active June 12, 2024 00:35
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,