Skip to content

Instantly share code, notes, and snippets.

View bvanhou's full-sized avatar

Benjamin Van Houten bvanhou

View GitHub Profile
@bvanhou
bvanhou / project-X-readme.MD
Last active May 15, 2023 23:00
Architecture Document for Distributed Runner. (Dr)
@bvanhou
bvanhou / team-replication.py
Last active March 2, 2023 19:08
GitHub : Replicate Teams to Repository
from github import Github, GithubException
def replicate_teams():
# Access token to authenticate with GitHub API
access_token = "<insert access token here>"
# Name of the source and target organizations and repositories
source_org_name = "source_org"
@bvanhou
bvanhou / osxForWindows.json
Created November 14, 2021 21:46
PowerToys - OSX Mappings for Windows
{
"remapKeys": {
"inProcess": [{
"originalKeys": "164",
"newRemapKeys": "162"
}, {
"originalKeys": "91",
"newRemapKeys": "164"
}, {
"originalKeys": "162",
@bvanhou
bvanhou / interview questions
Last active September 29, 2020 16:54
Interview Questions
Interview Questions
[Amazon, Nvidia, Ally, Microsoft, Lowes]
Difference between Stack and Queue and how would you do it in JS?
javascript call vs apply vs bind?
@bvanhou
bvanhou / autoscaling-lambda.ts
Created September 3, 2020 18:07
autoscaling-lambda.ts
// const AWS = require('aws-sdk');
import * as AWS from 'aws-sdk';
import * as async from 'async';
const as = new AWS.AutoScaling();
const ssm = new AWS.SSM();
const documentName = 'CircleCiDrainNodes' ; //name of the document to be executed on nodes
const {
@bvanhou
bvanhou / graceful-shutdown.tf
Last active September 3, 2020 18:03
CircleCI Graceful Shutdown
# resource "aws_sqs_queue" "circleci_graceful_termination_autoscale" {
# name = "circleci_graceful_termination_autoscale"
# }
resource "aws_lambda_permission" "with_sns" {
statement_id = "AllowExecutionFromSNS"
action = "lambda:InvokeFunction"
function_name = "${aws_lambda_function.circleci_graceful_shutdown.function_name}"
principal = "sns.amazonaws.com"
source_arn = "${aws_sns_topic.circleci_graceful_termination_autoscale.arn}"
}
@bvanhou
bvanhou / circleci-database-import.sh
Created September 2, 2020 21:36
CircleCI Database Import
#!/bin/bash
##
# CircleCI Database Import Script
#
# This script is for installations running CircleCI server 2.0 or higher.
#
# This script will create a tar ball of the PostgreSQL and Mongo databases.
# This should generally be used when you are planning on switching from
# the default embedded databases to an external database source.
@bvanhou
bvanhou / database-export-migration.sh
Created September 2, 2020 21:35
CircleCI Database Export
#!/bin/bash
##
# CircleCI Database Export Script
#
# This script is for installations running CircleCI server 2.0 or higher.
#
# This script will create a tar ball of the PostgreSQL and Mongo databases.
# This should generally be used when you are planning on switching from
# the default embedded databases to an external database source.
@bvanhou
bvanhou / autoscaling-lambda.ts
Last active August 5, 2020 14:12
Graceful Shutdown for CircleCI Nomad Clients
// const AWS = require('aws-sdk');
import * as AWS from 'aws-sdk';
import * as async from 'async';
const as = new AWS.AutoScaling();
const ssm = new AWS.SSM();
const documentName = 'CircleCiDrainNodes' ; //n ame of the document to be executed on nodes
const {
@bvanhou
bvanhou / pre-commit
Last active May 14, 2020 18:33
Pre-commit Hook for calling CircleCI CLI prior to commit
#!/bin/bash
# Pre-Commit Condition always checks if the source config has been modified
if (git diff --cached --name-only --diff-filter=AM $against | grep '.circleci/config.source.yml')
then
echo "Running CircleCI config process command"
echo "$(circleci config validate)"
echo "$(circleci config process .circleci/config.source.yml > .circleci/config.yml)"
# May need to check in the file before commiting
exit 0