Skip to content

Instantly share code, notes, and snippets.

@lxhunter
lxhunter / aws-login.sh
Last active September 7, 2018 15:36
Graphical Wrapper for assume-role
#!/bin/bash
if ! [ -x "$(command -v assume-role)" ]; then
echo 'Error: assume-role is not installed.' >&2
if [[ "$OSTYPE" == "linux-gnu" ]]; then
echo "Install assume-role via:" >&2
echo "$ curl https://raw.githubusercontent.com/coinbase/assume-role/master/install-assume-role -O" >&2
echo "$ cat install-assume-role # inspect the script for security" >&2
echo "$ bash ./install-assume-role # install assume-role" >&2
#!/bin/bash
output_file="shop.csv"
if [ ! -f $output_file ]; then
echo "domain,connection,status" >> "${output_file}"
fi
function domain_check_ssl {
RED="\033[1;31m"

Keybase proof

I hereby claim:

  • I am lxhunter on github.
  • I am lxhunter (https://keybase.io/lxhunter) on keybase.
  • I have a public key ASBFNBGoJlug7u2gGCPEwgHH6B_LwWNAF6HHyklIWB12Rgo

To claim this, I am signing this object:

@lxhunter
lxhunter / sha512-crypt
Created February 28, 2017 10:08
use python passlib to generate sha512-crypt on osx with optional rounds
#!/usr/bin/env python
# pip install passlib
import getpass
import random
import string
import argparse
from passlib.hash import sha512_crypt
@lxhunter
lxhunter / multi-dir-exec.sh
Last active September 7, 2018 15:31
Executing command in all direct sub directories
#!/bin/bash
for directory in *; do
if [ -d "${directory}" ]; then
echo "${directory}:"
(
cd "${directory}"
exec "${@}"
)
fi
@lxhunter
lxhunter / commit-msg.sh
Last active January 3, 2017 17:27
Git commit-msg hook to validate for semver
#!/usr/bin/env bash
# cd /to/where/the/repo/is/
# wget -O .git/hooks/commit-msg https://gist.githubusercontent.com/lxhunter/fe5384d28da3d0ed2efba33c61051779/raw/commit-msg.sh
# rm .git/hooks/commit-msg.sample
# chmod +x .git/hooks/commit-msg
message=$(cat $1)
if ! [[ "$message" =~ ^\[(patch|minor|major)\] ]]; then
@lxhunter
lxhunter / deploy.sh
Last active August 15, 2019 09:47
Ansible deployment with Travis-CI
#!/bin/bash
[ -z "$GITHUB_SSH_URL" ] && echo "You need to set GITHUB_SSH_URL - e.g. [email protected]:user/repository.git" && exit 1;
[ -z "$ANSIBLE_PLAYBOOK" ] && echo "You need to set ANSIBLE_PLAYBOOK - e.g. ANSIBLE_PLAYBOOK=deploy.yml" && exit 1;
[ -z "$ANSIBLE_HOSTS" ] && echo "You need to set ANSIBLE_HOSTS - e.g. ANSIBLE_HOSTS=host.ini" && exit 1;
[ -z "$ANSIBLE_ROLES_FOLDER" ] && echo "You need to set ANSIBLE_ROLES_FOLDER - e.g. ANSIBLE_ROLES_FOLDER=/var/tmp/user-repository/roles" && exit 1;
[ -z "$ANSIBLE_REQUIREMENTS_FILE" ] && echo "You need to set ANSIBLE_REQUIREMENTS_FILE - e.g. ANSIBLE_REQUIREMENTS_FILE=/var/tmp/user-repository/requirements.yml" && exit 1;
[ -z "$ANSIBLE_SSH_USER" ] && echo "You need to set ANSIBLE_SSH_USER - e.g. ANSIBLE_SSH_USER=user" && exit 1;
[ -z "$GIT_REPOSITORY" ] && echo "You need to set GIT_REPOSITORY - e.g. GIT_REPOSITORY=/var/tmp/user-repository" && exit 1;
[ -z "$GITHUB_BRANCH" ] && echo "You need to set GITHUB_BRANCH - e.g. GITHUB_BRANCH=master" && exit
@lxhunter
lxhunter / merge.sh
Created October 8, 2016 09:30
Automated merging of branches into master for travis-ci or any other ci
#!/bin/bash
git config --global user.email '[email protected]'
git config --global user.name 'Travis'
git remote set-branches --add origin master
git fetch
git reset --hard
git checkout master
git merge --ff-only "$TRAVIS_COMMIT"
git push git+ssh://[email protected]/${TRAVIS_REPO_SLUG}.git master
@lxhunter
lxhunter / semver.sh
Last active July 8, 2022 19:12
Automated semantic versioning for travis-ci or any other ci
#!/bin/bash
export SEMVER_LAST_TAG=$(git describe --abbrev=0 --tags 2>/dev/null)
export SEMVER_RELEASE_LEVEL=$(git log --oneline -1 --pretty=%B | cat | tr -d '\n' | cut -d "[" -f2 | cut -d "]" -f1)
#curl -o /tmp/hub.tgz https://github.com/github/hub/releases/download/v2.2.9/hub-linux-arm64-2.2.9.tgz
#tar -xvzf /tmp/hub.tgz -C /tmp
if [ -z $SEMVER_LAST_TAG ]; then
>&2 echo "No tags defined"