This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Usage: | |
./server_control show -e ENVIRONMENT -a APPLICATION | |
./server_control terminate -e ENVIRONMENT -a APPLICATION | |
./server_control launch -e ENVIRONMENT -a APPLICATION | |
Options: | |
-e ENVIRONMENT Environment the server is in. Supported values are staging, production. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# kill all subprocesses when the user presses CTRL + C | |
trap "kill 0" SIGINT | |
# exit on first failed command (good practice) | |
set -e | |
echo "Starting" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import mock | |
class AnyStringEndingWith(object): | |
def __init__(self, suffix): | |
self.suffix = suffix | |
def __repr__(self): | |
return "<a string ending with '%s'>" % self.suffix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package rpn | |
import ( | |
"stack" | |
"strconv" | |
"strings" | |
) | |
var operators = map[string]func(int, int) int{ | |
"+": func(left int, right int) int { return left + right }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyCoolClass(object): | |
def __init__(self, name): | |
self.name = name | |
foo = MyCoolClass("jordan") | |
print(foo.name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
YEAR=${1:?need year as argument} | |
cat <<EOF >go.mod | |
go 1.17 | |
module github.com/dishbreak/aoc$YEAR | |
EOF | |
go get -u github.com/dishbreak/aoc2020 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ecsiterator | |
import ( | |
"context" | |
"github.com/aws/aws-sdk-go-v2/aws" | |
"github.com/aws/aws-sdk-go-v2/service/ecs" | |
) | |
func GetContainerInstanceArnsForEcsCluster(e *ecs.Client, ecsClusterName string) ([]string) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"github.com/aws/aws-sdk-go-v2/service/ec2" | |
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types" | |
) | |
func DescribeAllInstances(instanceIDs []string, ec2Client *ec2.Client) ([]ec2types.Instance, error) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type person struct { | |
name string | |
age int | |
} | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def manager = org.jenkins.plugins.lockableresources.LockableResourcesManager.get() | |
def resources = manager.getResources().findAll{ | |
!it.locked | |
} | |
resources.each{ | |
manager.getResources().remove(it) | |
} | |
manager.save() |