Skip to content

Instantly share code, notes, and snippets.

@ddunkin
ddunkin / .gitconfig
Created December 19, 2023 16:53
gitconfig aliases
[alias]
undo = reset --soft HEAD~
branch-clean = "!git branch --merged master | grep -v '\\bmaster\\b' | xargs -n 1 git branch -d"

Keybase proof

I hereby claim:

  • I am ddunkin on github.
  • I am ddunkin (https://keybase.io/ddunkin) on keybase.
  • I have a public key ASAG8-yK8PYxAxNxxkJC6HS1fYkSW7PM_QGk5fmugqTZfgo

To claim this, I am signing this object:

using System;
using System.Globalization;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace MerryChristmas
{
public static class RLE
{
@ddunkin
ddunkin / node.ts
Last active December 21, 2018 04:07
/*
Implement locking in a binary tree. A binary tree node can be locked or unlocked only if all of its descendants or ancestors are not locked.
Design a binary tree node class with the following methods:
is_locked, which returns whether the node is locked
lock, which attempts to lock the node. If it cannot be locked, then it should return false. Otherwise, it should lock it and return true.
unlock, which unlocks the node. If it cannot be unlocked, then it should return false. Otherwise, it should unlock it and return true.
@ddunkin
ddunkin / cloudsql-proxy.ts
Last active September 21, 2022 15:10
Pulumi functions to setup and add a Google Cloud SQL Proxy sidecar to a Kubernetes deployment
import * as pulumi from '@pulumi/pulumi';
import * as gcp from '@pulumi/gcp';
import * as k8s from '@pulumi/kubernetes';
import * as k8sInputApi from '@pulumi/kubernetes/types/input';
const serviceAccountKeys = new Map<string, gcp.serviceAccount.Key>();
/**
* Creates a service account and key, and sets the cloudsql.client role in IAM.
*/
@ddunkin
ddunkin / Dockerfile
Created September 30, 2017 14:44
Red5 dockerfile
#
# Red5 + Java 8 Dockerfile
#
# forked from https://github.com/Red5/docker
#
FROM java:8
MAINTAINER Paul Gregoire <mondain@gmail.com>
ENV RED5_VERSION 1.0.9-RELEASE
@ddunkin
ddunkin / redisInfo.sh
Created May 11, 2016 19:20
create bash associative array of redis info
declare -A redisInfo
getRedisInfo() {
eval $(redis-cli INFO | tr -d '\r' | egrep -v '^(#.*)?$' | sed -E 's/^([^:]*):(.*)$/redisInfo[\1]="\2"/')
}
# example use: getRedisInfo ; echo ${redisInfo[redis_version]}
@ddunkin
ddunkin / gist:f30b48bcc760640d3437ae6c27cbdea3
Created April 2, 2016 20:45
Create tarballs for all directories matching a pattern
find . -name "*.xcarchive" -type d -exec tar -czf "{}.tgz" -C "$(dirname "{}")" "$(basename "{}")" ";"
@ddunkin
ddunkin / gist:9bc7e2962909b3c8e829
Created September 29, 2015 00:49
ruby sum first column from stdin
ruby -e 'sum = 0 ; ARGF.each_line { |l| sum = sum + l.split.first.to_i } ; puts sum'