Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am tlesh989 on github.
  • I am tlesh (https://keybase.io/tlesh) on keybase.
  • I have a public key ASBwli_FUYjXjQJfgLLtb3eYoyprLKoEZStv413gnxXmCQo

To claim this, I am signing this object:

@tlesh989
tlesh989 / hashicorp_update.sh
Created April 24, 2018 21:02
Update Hashicorp products
#!/bin/bash
# array listing requested hashicorp products all lowercase
HASHICORP=(packer terraform vagrant)
DOWNLOAD_URL="https://releases.hashicorp.com"
TMP_DIR="/tmp"
# install products to this directory and create symbolic links to USER_DIR
INSTALL_DIR="/opt/hashicorp"
USER_DIR="/usr/bin"
FILE_EXT="linux_amd64.zip"
# vagrant is packaged differently, currently this script only works with dpkg package manager
@tlesh989
tlesh989 / ubuntu_setup.sh
Last active February 15, 2020 14:18
Ubuntu laptop setup, work in progress
#! /usr/bin/env bash
sudo add-apt-repository ppa:stebbins/handbrake-releases -y
sudo add-apt-repository ppa:oibaf/graphics-drivers -y
sudo sh -c 'echo "deb http://archive.canonical.com/ubuntu/ bionic partner" >> \
/etc/apt/sources.list.d/canonical_partner.list'
sudo add-apt-repository ppa:ubuntu-desktop/ppa -y
sudo add-apt-repository ppa:nilarimogard/webupd8 -y
sudo add-apt-repository ppa:videolan/stable-daily -y
sudo apt-add-repository ppa:fish-shell/release-3 -y
@tlesh989
tlesh989 / monit-vsftpd
Created March 10, 2020 01:18
CentOS 7.7 vsftpd server with monit
check process vsftpd
matching vsftpd
start program = "/usr/bin/systemctl start vsftpd" with timeout 60 seconds
stop program = "/usr/bin/systemctl stop vsftpd"
if cpu > 60% for 5 cycles then alert
if cpu > 80% for 10 cycles then restart
if memory usage > 75% then alert
if memory usage > 90% then restart
if failed port 21000 protocol ftp for 2 cycles then alert
if failed port 21000 protocol ftp for 4 cycles then restart
@tlesh989
tlesh989 / update.fish
Last active October 26, 2022 20:18
Linux Fish system update function
function update
if [ "$(which apt-get 2>/dev/null)" != '' ]
sudo apt update -y
sudo apt upgrade -y
sudo apt autoremove -y
else if [ "$(which dnf 2>/dev/null)" != '' ]
sudo dnf update -y
end
if [ "$(which snap 2>/dev/null)" != '' ]
sudo snap refresh
@tlesh989
tlesh989 / sshd_config
Created January 20, 2021 01:48
Default CentOS 7 sshd_config file
# $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/bin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
@tlesh989
tlesh989 / nginx.conf
Last active March 2, 2022 14:25
basic nginx config with clean logging
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
@tlesh989
tlesh989 / ping_mongodb_cluster.sh
Last active March 16, 2022 16:49
script to test connectivity to all nodes in a mongodb cluster
#!/usr/bin/env bash
readarray -t mongo_cluster <<< "$(dig +short srv _mongodb._tcp.example.com | awk '{print $4}')"
function ping_cluster() {
a=("$@")
for i in "${a[@]}"
do
nc -w 3 -z -v "$i" 27017
done
@tlesh989
tlesh989 / config.yaml
Last active October 27, 2022 13:34
Live Migration from DigitalOcean MongoDB cluster to MongoDB Atlas using mongomirror
destinationPassword: password
uri: mongodb+srv://username:password@primary.mongo.ondigitalocean.com/admin?tls=true&authSource=admin&replicaSet=replicaset
@tlesh989
tlesh989 / 00-network.yaml
Created January 11, 2023 18:28
Ubuntu 22.04 Netplan
network:
version: 2
ethernets:
eno1: {}
eno2: {}
enp5s0f0: {}
enp5s0f1: {}
bonds:
bond0:
addresses: