Skip to content

Instantly share code, notes, and snippets.

View nir0s's full-sized avatar
💭
Multiplying forces

nir0s nir0s

💭
Multiplying forces
View GitHub Profile
@nir0s
nir0s / semver-github-release.sh
Last active April 11, 2022 09:51
Use semver to release to GitHub
#!/bin/bash
function log() {
local -r level="$1"
local -r message="$2"
echo -e "[$level] $message"
}
function _get_bump_part() {
@nir0s
nir0s / lambda-cfn-stack-delete.py
Last active January 9, 2021 00:48
A Lambda function to delete a CloudFormation Stack on Pull Request Close GitHub Event
import sys
import json
import logging
import boto3
def _get_logger():
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler(sys.stdout))
Description: >
This stack provisions the required resources for a per-branch strigo app.
The main idea here is that it creates host-header based listener rules which direct specific
hosts (e.g. test.app-dev.strigo.io) to a specific ALB Target Group behind which is the
instance containing the branch's code.
See http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-listenerrule.html
Parameters:
Branch:
Description: The name of the branch to build for
@nir0s
nir0s / strigo-deploy-dev-env.sh
Last active July 18, 2019 20:03
Strigo's Development Environment Provisioning Script
#!/usr/bin/env bash
###
# The script uses CFN to provision a Target Group in the app-dev ALB, and creates
# an instance behind that target group, after which it attaches two host-header
# based rules to the HTTP/HTTPS listeners which target the newly created target group.
# After the stack is up, it installs the relevant Strigo app, ssc and job-worker builds
# on it for the relevant branch.
#
# NOTE: AWS_DEFAULT_REGION, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be set prior to running this.
@nir0s
nir0s / Keybase
Created May 23, 2017 09:59
Keybase
### Keybase proof
I hereby claim:
* I am nir0s on github.
* I am nir0s (https://keybase.io/nir0s) on keybase.
* I have a public key ASDIFbCPY7rqb9caC4JnXr7JpQpzS2ALWFP23A1WAJpJSQo
To claim this, I am signing this object:
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
if [ $# -eq 0 ]; then
exit 0
@nir0s
nir0s / dockr
Created January 21, 2015 19:04
dockr - some useful docker shortcuts
#!/bin/bash
# add yourself to the docker group
# useradd -G docker USERNAME
# then you can enjoy this (for instance)
# dockr get logstash_container ip - to get the ip of the container
# or
# dockr stop last - to stop the last container you ran
# or
# dockr rmi none - to remove all <none> images
@nir0s
nir0s / convert_string_to_json_list.py
Last active August 29, 2015 14:06
Parses a string and returns a list of JSON's
def convert_string_to_json_list(string):
"""This will receive a string as an input, count curly braces and ignore
any newlines. When the curly braces stack is 0, it will append the
entire string it has read up until then to a list and continue.
:param string: the string to parse
:rtype: list of JSON's
"""
stack = 0
json_list = []
@nir0s
nir0s / Preferences.sublime-settings
Last active December 30, 2015 17:50
my sublime-text3 (st3) config and plugins
{
"caret_extra_width": 1,
"caret_style": "phase",
"color_scheme": "Packages/User/Material-Theme-OceanicNext (Flake8Lint).tmTheme",
"copy_with_empty_selection": false,
"drag_text": false,
"draw_minimap_border": true,
"enable_tab_scrolling": false,
"font_face": "Roboto Mono",
"font_options":
@nir0s
nir0s / create-todos.sh
Created June 5, 2014 06:22
create a todo file from your in-code "# TODO:" strings
# run from repo dir
grep '# TODO' -rn * --exclude-dir=docs --exclude-dir=build --exclude-dir=*.egg --exclude=TODO.md | sed 's/: \+#/: # /g;s/:#/: # /g' | sed -e 's/^/- /' | grep -v Makefile > TODO.md