Skip to content

Instantly share code, notes, and snippets.

View tonyclemmey's full-sized avatar

Tony Clemmey tonyclemmey

  • London
View GitHub Profile
sudo nano /etc/logrotate.d/mongod.conf
```
/var/log/mongodb/mongod.log {
daily
size 100M
rotate 7
missingok
compress
delaycompress
### MongoDB Backup
----
**Shell Script / Cron Job**
File :
@tonyclemmey
tonyclemmey / netplan2NM.sh
Created November 24, 2022 12:40 — forked from dbkinghorn/netplan2NM.sh
Change Ubuntu 20.04 server netplan to use NetworkManager instead of networkd
#!/usr/bin/env bash
# netplan2NM.sh
# Ubuntu server 20.04 Change from netplan to NetworkManager for all interfaces
echo 'Changing netplan to NetowrkManager on all interfaces'
# backup existing yaml file
cd /etc/netplan
cp 01-netcfg.yaml 01-netcfg.yaml.BAK
@tonyclemmey
tonyclemmey / compare_packages.sh
Last active November 19, 2022 00:45
Ubuntu Packages
#!/usr/bin/perl -w
# run: "apt list --installed | tail -n +2 > file.list" on each computer
# name them: compare_one.list and compare_two.list
use strict;
use warnings;
my $num_args = $#ARGV + 1;
my $file_one="compare_one.list";
my $file_two="compare_two.list";
@tonyclemmey
tonyclemmey / setup_apparmor.sh
Last active November 1, 2022 14:13
MongoDB Setup
#!/bin/bash
# ===================================
# ########## Bash Colours ###########
# ===================================
NC='\033[31;0m' # no colors or formatting
RED='\033[0;31;1m' # print text in bold Red
GRE='\033[0;32;1m' # print text in bold Green
YEL='\033[0;33;1m' # print text in bold Yellow
BLU='\033[0;34;1m' # print text in bold Blue
@tonyclemmey
tonyclemmey / hardening.sh
Last active November 1, 2022 14:29
Ubuntu Hardening
#!/bin/bash
# ===================================
# ########## Bash Colours ###########
# ===================================
NC='\033[31;0m' # no colors or formatting
RED='\033[0;31;1m' # print text in bold Red
GRE='\033[0;32;1m' # print text in bold Green
YEL='\033[0;33;1m' # print text in bold Yellow
BLU='\033[0;34;1m' # print text in bold Blue
@tonyclemmey
tonyclemmey / disks.sh
Created October 18, 2022 23:07
Ubuntu Disks Setup
#!/bin/bash
# ===================================
# ########## Bash Colours ###########
# ===================================
NC='\033[31;0m' # no colors or formatting
RED='\033[0;31;1m' # print text in bold Red
GRE='\033[0;32;1m' # print text in bold Green
YEL='\033[0;33;1m' # print text in bold Yellow
BLU='\033[0;34;1m' # print text in bold Blue
@tonyclemmey
tonyclemmey / usps-remove-priority-flat-rate-envelopes.php
Last active October 2, 2022 12:57 — forked from woogists/usps-remove-priority-flat-rate-envelopes.php
[USPS Shipping Method] To remove all the USPS Priority Flat Rate envelopes, leaving only the Small, Medium, and Large Flat Rate boxes, add this to your theme's functions.php file:
<?php
/**
* Plugin Name: Woocommerce USPS Shipping Method remove flat rate envelopes
* Plugin URI: https://tcdesignio.co.uk
* Description: <code>Woocommerce USPS Shipping Method remove flat rate envelopes <strong> - TCDESIGN</strong></code>
* Version: 1.0.0
* Tested up to: 6.0
*/
/**
@tonyclemmey
tonyclemmey / install_libdb4.8.sh
Created June 28, 2022 20:17 — forked from darosior/install_libdb4.8.sh
Install libdb4.8 on Debian (from Ubuntu ppa) for i386 or amd64
#!/usr/bin/env bash
if [ "$#" -ne "1" ]; then
echo "usage :"
echo " $0 <amd64|i386>"
elif ! [ "$1" = "amd64" ] && ! [ "$1" = "i386" ]; then
echo "Bad architecture argument. First and only argument must be amd64 or i386."
else
mkdir "tmplibdb" && cd "tmplibdb"
if [ "$1" = "amd64" ]; then
@tonyclemmey
tonyclemmey / nginx_client_cn_auth.conf
Created May 2, 2022 15:50 — forked from schtobia/nginx_client_cn_auth.conf
CN-based client authentification with nginx. This emulates Apache's SSLRequire (%{SSL_CLIENT_S_DN_CN} in {"Really Me"})
map $ssl_client_s_dn $ssl_client_s_dn_cn {
default "";
~/CN=(?<CN>[^/]+) $CN;
}
server {
listen 80;
listen [::]:80;
listen 443 ssl;