Skip to content

Instantly share code, notes, and snippets.

@sandwern
sandwern / snapshot.md
Created August 30, 2021 14:26 — forked from greenbrian/snapshot.md
Consul Snapshot restore Vault cluster

Take a consul snapshot:

consul snapshot save backup.snap

Verify consul snapshot:

consul snapshot inspect backup.snap

Stop Consul

systemctl stop consul.service

Stop Vault

@sandwern
sandwern / send.ps1
Created August 30, 2019 07:42 — forked from ser1zw/send.ps1
Send E-mail from eml file in PowerShell
################################################################################
# Send E-mail from eml file in PowerShell
# Tested on PowerShell 2.0
#
# Usage:
# 1. Configure the variables defined in Main()
# $server = "localhost"
# $port = "25"
# $mailfrom = "from@example.com"
# $rcptto = "to@example.com"
@sandwern
sandwern / ldapsearch.sh
Created August 28, 2019 15:34 — forked from boina-n/ldapsearch.sh
ldap search for CN
cat /tmp/list.cuid.txt | while read line ; do echo $( echo "$line;"$(ldapsearch -H ldaps://$ldapserver -w $ldappassword -b "dc=domain,dc=exemple,dc=com" -D "CN="$cuid",OU=Utilisateurs,OU=France Telecom,DC=domain,DC=exemple,DC=com" -s sub "CN=$line" | grep "displayName:\|department:\|telephoneNumber:\|mail:" | awk -F ":" '{ $1 ~ "telephone ; print $2 }' | tr '\n' ';' ) ); done | tee /tmp/list.cuid.csv
@sandwern
sandwern / smtp-telnet.sh
Created August 28, 2019 15:33 — forked from boina-n/smtp-telnet.sh
Use telnet to send email with an attachement
#!/bin/bash
filename="/path/to/your/file.log"
subject="Subject of my email"
txtmessage="This is the message I want to send"
{
sleep 1;
echo "EHLO mydomain.intra"
sleep 1;
@sandwern
sandwern / softether.sh
Created June 19, 2019 19:32 — forked from bouroo/softether.sh
Install softether vpn server on ubuntu 16.04+
#!/usr/local/env bash
# Register digitalocean with free credit https://m.do.co/c/4879bb02d178
# Create vps with 5usd price
# Tested on Ubuntu 18.04, Debian 9.6
# How to...
# 1. Save this file as softether-installer.sh
# 2. chmod +x softether-installer.sh
# 3. Run bash file
# > ./softether-installer.sh
# Or just
@sandwern
sandwern / install virtualenv ubuntu 16.04.md
Created February 25, 2018 14:53 — forked from Geoyi/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv