Skip to content

Instantly share code, notes, and snippets.

View Reda-ELOUAHABI's full-sized avatar

Reda El Ouahabi Reda-ELOUAHABI

View GitHub Profile
@Vedrana
Vedrana / MedianOfIntegerStream.java
Created September 8, 2012 14:30
Median of stream of integers
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Queue;
// Given a stream of unsorted integers, find the median element in sorted order at any given time.
// http://www.ardendertat.com/2011/11/03/programming-interview-questions-13-median-of-integer-stream/
public class MedianOfIntegerStream {
public Queue<Integer> minHeap;
public Queue<Integer> maxHeap;
@arch1t3ct
arch1t3ct / last_business_day_of_month.js
Created November 30, 2012 10:17
Javascript (Node.js) function for getting last working/business day of the month.
/**
* Finds last working/business day of the month.
*
* Not tested for cross-browser compability. Works in Node.js though.
*
* EXAMPLES:
*
* 1. Returns last day of the last month of the current year:
*
* var result = lastBusinessDayOfMonth();
@keithweaver
keithweaver / s3-file-upload.js
Last active August 21, 2023 19:30
S3 File Upload to AWS S3
const AWS = require('aws-sdk');
const Busboy = require('busboy');
const BUCKET_NAME = '';
const IAM_USER_KEY = '';
const IAM_USER_SECRET = '';
function uploadToS3(file) {
let s3bucket = new AWS.S3({
accessKeyId: IAM_USER_KEY,
@ketzacoatl
ketzacoatl / alb.tf
Created October 6, 2017 11:41
Terraform example ALB w/ target groups for an ASG
# Security Group for ALB
resource "aws_security_group" "atlassian-alb" {
name = "${var.name}-load-balancer"
description = "allow HTTPS to ${var.name} Load Balancer (ALB)"
vpc_id = "${module.vpc.vpc_id}"
ingress {
from_port = "443"
to_port = "443"
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]