Skip to content

Instantly share code, notes, and snippets.

View perfecto25's full-sized avatar

mrx perfecto25

  • NYC
View GitHub Profile
@perfecto25
perfecto25 / sftp.json
Last active July 5, 2019 19:14
SFTP vscode sample config
{
"name": "devsaltmaster",
"host": "devsaltmaster",
"protocol": "sftp",
"port": 22,
"username": "root",
"password": "xxx",
// or use "privateKeyPath": "/home/user/.ssh/id_rsa",
"remotePath": "/srv/saltstack",
"uploadOnSave": true,
#!/usr/bin/env python
import json
import salt.client
import salt.config
import salt.loader
import salt.modules.smtp
notify = 'admin@company.com'
smtp = 'localhost'
@perfecto25
perfecto25 / resticheat.md
Last active March 3, 2024 12:34
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
@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="user@company.com"
LOG="/var/log/restic.log"
RDIR="/etc/restic"
@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 / sudo.py
Last active August 31, 2023 05:45
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 / 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 / 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
#!/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 / 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"