Skip to content

Instantly share code, notes, and snippets.

@ggreenleaf
ggreenleaf / .env.example
Last active June 30, 2022 12:30
SqlServer and azureite blob emulator docker compose with volumes
SQLSERVER_SA_PASSWORD=%%placeholder%%
SQLSERVER_DATA_PATH=/path/to/some/local/dir/data
SQLSERVER_LOG_PATH=/path/to/some/local/dir/log
SQLSERVER_SECRETS_PATH=/path/to/some/local/dir/secret
AZURITE_DATA_PATH=/path/to/some/local/dir/azurite
MIGRATION_CONNECTION_STRING=%%Placeholder%%
@ggreenleaf
ggreenleaf / angular.ts
Last active January 13, 2022 17:47
Sample of linking google analytics with angular
// Google Analytics Service
init() {
if (!this.scriptsLoaded) {
this.insertMainScript();
}
}
trackPageViews() {
return this.router.events.pipe(
@ggreenleaf
ggreenleaf / gist:a6d6feed44968bd093d5
Created September 17, 2015 23:40
Select using median of medians
def select(ls,i):
'''select the ith order stat of the list ls'''
subs = [sorted(ls[i:i+5]) for i in xrange(0,len(ls),5)] #partition in n/5 groups of length at most 5 each
median_ls = [sub[len(sub)/2] for sub in subs]
print "median",median_ls
pivot = select(median_ls,len(median_ls)/2) #pivot is the median of medians
import java.util.concurrent.Semaphore;
public class Sem1 implements Runnable
{
private int num;
private static Semaphore sem = new Semaphore( 0, true );
Sem1( int num )
//Bucket Sort
//Project 4
import java.util.*;
public class BucketSort {
private int [] a;
private int [] buckets;
public Random random;
public BucketSort(int size) {
//Assingment 2 shell
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
//prototypes
/*
* sh1.c: sample version 1 of a UNIX command shell/interpreter.
* Stefan Brandle, COS 421, Feb 2000. Mod Feb 2001.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
public class GenLinkedList <T> {
/*======================================
= members specific to list =
======================================*/
/*=============================================
= Node Definition (element of List) =
=============================================*/
private static class Node <T> {
/**
var http = require('http');
var concatStream = require("concat-stream")
var urls = process.argv.slice(2);
var results = [];
function printResults (results) {
results.forEach (function (result) {
console.log(result)