Skip to content

Instantly share code, notes, and snippets.

View perfecto25's full-sized avatar

mrx perfecto25

  • NYC
View GitHub Profile
@perfecto25
perfecto25 / bitbucket_branch_cleaner.py
Last active January 11, 2019 18:08
Deletes Pull Requests and Branches from a given repository in BitBucket
#!/usr/bin/env python
# coding=utf-8
# Deletes all branches and pull requests from a Repo unless its 'master' or 'production'
# TO BE USED ON DEV BITBUCKET INSTANCE ONLY!!!
from __future__ import print_function
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
@perfecto25
perfecto25 / getNessusCSV.py
Last active August 10, 2021 11:05
Nessus API scripts
#!/usr/bin/env python
# coding=utf-8
# GET NESSUS CSV
# gets Nessus reports as CSV export
import sys
import os
import glob
from ast import literal_eval
@perfecto25
perfecto25 / inject_cert.yaml
Created June 20, 2018 22:03
Ansible playbook to inject a host cert into a CA certs file
# Injects an external cert into 'cacerts'
- hosts: target
vars:
cert_server: ldap.server.company:636 # FQDN
cert_alias: ldap.server
app: myApp
app_install_dir: "/opt/application"
#!/bin/bash
CURR_USER="$(whoami)"
ANACONDA_URL="https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh"
_DB_PASSWORD="airflow992x"
_IP=$(hostname -I | cut -d' ' -f1)
while getopts "a:p:h" opt; do
case $opt in
a) ANACONDA_URL="$OPTARG";;
p) _DB_PASSWORD="$OPTARG";;
@perfecto25
perfecto25 / openvpn_install.sh
Created October 28, 2018 03:49
openvpn installer
#!/bin/bash
# Secure OpenVPN server installer for Debian, Ubuntu, CentOS and Arch Linux
# https://github.com/Angristan/OpenVPN-install
# Verify root
if [[ "$EUID" -ne 0 ]]; then
echo "Sorry, you need to run this as root"
exit 1
@perfecto25
perfecto25 / install_py37_centos7.sh
Last active October 3, 2019 16:36
Install python 3.7 on Centos 7 or Ubuntu 16
#!/bin/bash
# Installs Python 3.7 on Centos 7
yum -y install libffi-devel gcc openssl-devel bzip2-devel
cd /usr/src
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar xzf Python-3.7.0.tgz
cd Python-3.7.0/
@perfecto25
perfecto25 / sudo.py
Last active May 21, 2025 01:02
saltstack sudo module
# Custom Execution Module - SUDO ACCESS
# tested for Centos 7
import salt
import time
import os
import logging
import re
from datetime import datetime, timedelta
import subprocess
@perfecto25
perfecto25 / ipip.sh
Last active February 28, 2023 07:28
IPIP Tunnel Maker
#!/bin/bash
# this script creates an IPIP Tunnel
# tested for CENTOS 6 & 7
#----------------------------
# CONFIGURATION
#----------------------------
# name of tunnel
name='tun_test'
@perfecto25
perfecto25 / restic_cron.sh
Created February 28, 2019 23:20
Restic cron script
#!/bin/bash
# Runs Restic backup on a schedule via cron, emails with status
# 1. add a cred file with your repo logins to /etc/restic/cred
# 2.
FROM="restic@$(hostname)"
EMAIL="[email protected]"
LOG="/var/log/restic.log"
RDIR="/etc/restic"
@perfecto25
perfecto25 / resticheat.md
Last active July 19, 2025 02:26
Restic cheatsheet

Restic backup application - commands cheatsheet

Installation & config

  1. add Retic repo
  2. yum install restic

add a Restic credential file to root

vim /root/.restic