Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Script to install the virtual packages for Hyper-V in Debian
echo "Installing the needed packages..."
apt install hyperv-daemons
echo ""
echo "Making the needed changes to '/etc/initramfs-tools/modules' ..."
echo "" >> /etc/initramfs-tools/modules
@SammyEnigma
SammyEnigma / 00-docker-shorewall.md
Created March 18, 2021 07:06 — forked from lukasnellen/00-docker-shorewall.md
setup shorewall for docker networking beyond the default bridge network, e.g., for docker-compose

Docker(-compose) with shorewall

The shorewall documentation explains in http://shorewall.org/Docker.html how to configure shorewall for use with docker. The problem with the configuration is that it only allows connections from the host to the main bridge docker0. Connections to other networks on dynamically created bridges, with names starting by default with br-, is blocked. Instead of the recommended contents of /etc/shorewall/interfaces, use wild-card interface names as follows:

#ZONE	INTERFACE	OPTIONS
#dock	docker0		bridge     # disabled default recommendation
dock 	docker0		physical=docker+,routeback=1
dock 	br		physical=br-+,routeback=1
@SammyEnigma
SammyEnigma / hulk.sh
Created March 2, 2021 04:43 — forked from tikenn/hulk.sh
Download IP ban list and format for NGINX
#!/bin/bash
#
# --------------------------------------------------------------------------------------------
# Nginx IP Address Deny List download and format
# --------------------------------------------------------------------------------------------
# This file pulls from http://www.stopforumspam.com/downloads/bannedips.zip to
# retrieve a list of IPs known to be associated with spam. The program
# downloads, unzips, and formats the IP addresses into an NGINX config using
# 'deny'
#
@SammyEnigma
SammyEnigma / ssl.rules
Created December 2, 2020 13:05 — forked from konklone/ssl.rules
nginx TLS / SSL configuration options for konklone.com
# Basically the nginx configuration I use at konklone.com.
# I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com
#
# To provide feedback, please tweet at @konklone or email [email protected].
# Comments on gists don't notify the author.
#
# Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites.
# Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration.
server {
@SammyEnigma
SammyEnigma / nginx.conf
Created December 2, 2020 13:02 — forked from 6aditya8/nginx.conf
Nginx SSL/TLS configuration for getting "A+" in Qualys SSL Labs test
# Configuration options are limited to SSL/TLS
# Enable SSL session caching for improving performance by avoiding the costly session negotiation process where possible
# SSL Labs doesn't assume that SNI is available to the client, so it only tests the default virtual server
# setting this globally to make it work across all the nginx virtual servers (including the default virtual server)
ssl_session_cache shared:ssl_session_cache:10m;
ssl_session_timeout 10m;
server {
listen 443 ssl;
@SammyEnigma
SammyEnigma / dump
Created November 25, 2020 09:40 — forked from ipedrazas/dump
Mongo dump/restore with docker
# Backup DB
docker run \
--rm \
--link running_mongo:mongo \
-v /data/mongo/backup:/backup \
mongo \
bash -c ‘mongodump --out /backup --host $MONGO_PORT_27017_TCP_ADDR’
# Download the dump
scp -r USER@REMOTE:/data/mongo/backup ./backup
@SammyEnigma
SammyEnigma / mongoconsole.sh
Created November 25, 2020 09:39 — forked from stanislavb/mongoconsole.sh
Backup and restore MongoDB running in a Docker container
#!/bin/bash
usage() {
echo "Usage $0 -c mongo_docker_container_name"
}
while [[ $# > 1 ]]
do
key="$1"
@SammyEnigma
SammyEnigma / RemoveServiceSystemd
Created November 21, 2020 20:51 — forked from bobtownsend/RemoveServiceSystemd
Recipe to remove a service in Linux systemd
systemctl stop [servicename]
systemctl disable [servicename]
rm /etc/systemd/system/[servicename]
rm /etc/systemd/system/[servicename] symlinks that might be related
systemctl daemon-reload
systemctl reset-failed
@SammyEnigma
SammyEnigma / ubuntu-run-dhclient-on-startup.md
Created November 21, 2020 19:17 — forked from mohamadaliakbari/ubuntu-run-dhclient-on-startup.md
Run dhclient on Startup in Ubuntu 18.04

dhclient is the Dynamic Host Configuration Protocol (DHCP) Client one would use to allow a client to connect to a DHCP server.

$ sudo nano /etc/rc.local

#!/bin/bash
dhclient
exit 0
@SammyEnigma
SammyEnigma / Instrumentor.h
Created November 16, 2019 10:28 — forked from TheCherno/Instrumentor.h
Basic Instrumentation Profiler
//
// Basic instrumentation profiler by Cherno
// Usage: include this header file somewhere in your code (eg. precompiled header), and then use like:
//
// Instrumentor::Get().BeginSession("Session Name"); // Begin session
// {
// InstrumentationTimer timer("Profiled Scope Name"); // Place code like this in scopes you'd like to include in profiling
// // Code
// }