Skip to content

Instantly share code, notes, and snippets.

@thetemplateblog
thetemplateblog / git.py
Created April 13, 2023 14:42 — forked from crbyxwpzfl/git.py
python script for git
import subprocess
#import privates variable
import sys
import os
sys.path.append(os.path.join(os.getenv('privates')))
import privates
def test():
global branch
@thetemplateblog
thetemplateblog / ec2_sg_rules.py
Created March 16, 2023 19:35 — forked from amgill/ec2_sg_rules.py
Generate AWS Security Groups Rules Report of all the Security Groups, as Seen via AWS Web Console. Uses python 3 with boto3 to generate CSV.
#!/usr/local/bin/python3
######################################################################################################################
# Purpose: Generate rules report of all the security groups #
# Input Params: None [Make sure to set AWS CLI session by populating env. vars. with keys.] #
# Usage: ./ec2_sg_rules.py > account-date.csv [python ./ec2_sg_rules.py > gill-dev-sg-2018-04-11.csv] #
# Author: Abdul Gill #
# Doc. Ref: http://boto3.readthedocs.io/en/latest/reference/services/ec2.html#EC2.Client.describe_security_groups#
######################################################################################################################
from __future__ import print_function
@thetemplateblog
thetemplateblog / security-group-cleanup.py
Last active February 17, 2023 15:07 — forked from pet0ruk/security-group-cleanup.py
Security Group Cleanup using boto3
#!/usr/bin/env python
import boto3
import argparse
def lookup_by_id(sgid):
sg = ec2.get_all_security_groups(group_ids=sgid)
return sg[0].name
@thetemplateblog
thetemplateblog / security-group-cleanup.py
Created February 17, 2023 03:19 — forked from sa-jbrooks/security-group-cleanup.py
Security Group Cleanup using boto3
#!/usr/bin/env python
import boto3
import argparse
def lookup_by_id(sgid):
sg = ec2.get_all_security_groups(group_ids=sgid)
return sg[0].name
@thetemplateblog
thetemplateblog / countries.md
Created April 7, 2022 15:46 — forked from richjenks/countries.md
ISO 3166 countries by region — AMER, EMEA & APAC
Country ISO 3166 Region
Afghanistan AF EMEA
Åland Islands AX EMEA
Albania AL EMEA
Algeria DZ EMEA
American Samoa AS APAC
Andorra AD EMEA
Angola AO EMEA
Anguilla AI AMER
@thetemplateblog
thetemplateblog / docker_backup.py
Created July 21, 2020 12:28 — forked from firecat53/docker_backup.py
Backup docker volumes
#!/usr/bin/env python3
"""Backs up and restores data-only volumes to/from host backup directory using
rsync. Only backup named volumes, which is arbitrarily set to ones having a name
length < 40 characters.
1. Create a Docker image containing rsync (named rsync)
https://github.com/firecat53/dockerfiles/tree/master/rsync
``docker build -t rsync .``
@thetemplateblog
thetemplateblog / gitlab-sync-projects
Created August 6, 2019 15:28 — forked from elferink/gitlab-sync-projects
Gitlab: Clone / Pull all projects in a group
#!/bin/sh
# Source
# https://gist.github.com/JonasGroeger/1b5155e461036b557d0fb4b3307e1e75
# API Documentation
# https://docs.gitlab.com/ce/api/projects.html#list-projects
GITLAB_URL="https://{GITLAB_URL}/"
GITLAB_PRIVATE_TOKEN=""
NAMESPACE="$1"
@thetemplateblog
thetemplateblog / update.sh
Created May 7, 2019 19:46 — forked from mslinn/update.sh
Bash Script to Update all Git Directories Below Current Directory or Specified Directory
#!/bin/bash
# From ScalaCourses.com Introduction to Play Framework with Scala course
# Update all git directories below current directory or specified directory
# Skips directories that contain a file called .ignore
#
# Using printf insteach of echo -e for Mac OS
# See http://stackoverflow.com/questions/4435853/echo-outputs-e-parameter-in-bash-scripts-how-can-i-prevent-this
@thetemplateblog
thetemplateblog / htpasswd.py
Created December 7, 2018 11:57 — forked from guerrerocarlos/htpasswd.py
Python script for generating htaccess passwords
#!/usr/bin/python
"""Replacement for htpasswd"""
# Original author: Eli Carter
import os
import sys
import random
from optparse import OptionParser
# We need a crypt module, but Windows doesn't have one by default. Try to find
@thetemplateblog
thetemplateblog / gunicorn_start.bash
Created December 3, 2018 00:28 — forked from postrational/gunicorn_start.bash
Example of how to set up Django on Nginx with Gunicorn and supervisordhttp://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=hello # the user to run as
GROUP=webapps # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name