Skip to content

Instantly share code, notes, and snippets.

@gellweiler
gellweiler / .gitlab-ci.yml
Last active April 4, 2024 13:03
snapshot_manager.sh
stages:
- snapshot
create_snapshot:
stage: snapshot
image:
name: amazon/aws-cli
entrypoint: ["/bin/sh", "-c"]
script:
- bash ./snapshot_manager.sh new_snapshot
@gellweiler
gellweiler / configure-firewall.sh
Created August 16, 2021 09:33
Script to setup a dns based firewall based on iptables/dnsmasq on Debian/Linux.
#!/bin/bash
DNS_SERVER_1="8.8.8.8"
DNS_SERVER_2="8.8.8.4"
INT=eth0
IPTABLES="/usr/sbin/iptables"
IPSET="/usr/sbin/ipset"
@gellweiler
gellweiler / README.md
Last active July 31, 2021 14:41
Setup TOTP authentication for an aws cognito user.

This shell script will guide you through setting up TOTP authentiaction for an aws cognito user. It generates a qr code that can be scanned by a TOTP authenticator app.

Requirements:

  • Aws-Cli
  • jq
  • qrencode
@gellweiler
gellweiler / README.md
Last active October 18, 2023 21:49
Use basic auth with selenium

This java class provides a simple way to achieve basic auth in recent versions of selenium (current version 3.x) with recent versions of google chrome (current year 2020). It dynamically generates a tiny extension that will add the Authorization header for you.

How to use it:

    // Add basic auth header with a chrome extension on every request
    File authExtension = new SeleniumChromeAuthExtensionBuilder()
        .withBasicAuth("Ali Baba", "Open sesame")
        .withBaseUrl("https://example.org/*")
 .build();
@gellweiler
gellweiler / update-civicrm-wp.sh
Last active January 2, 2022 10:07
Update-Script for CiviCRM running on Wordpress
#!/bin/bash
#
# Shell script to upgrade CiviCRM on Wordpres.
#
# Saves the existing database and directory.
# Then downloads and installs the new civicrm version & language pack.
# Finally updates the db.
# On error it will try to rollback to the state prior to updating.
#
# You will have to cleanup the files in $TEMP_DIR configured below for yourself
@gellweiler
gellweiler / donwload_logs.sh
Last active September 7, 2020 22:05
Download access logs from telekom homepage center.
#!/bin/sh
set -euo pipefail
TELEKOM_ID='XXX'
missing_var=0
if [ -z "${TELEKOM_USERNAME:-}" ]; then
echo >&2 "[ERROR] Missing \$TELEKOM_USERNAME"
missing_var=1
@gellweiler
gellweiler / README.md
Last active January 25, 2018 14:21 — forked from denilsonsa/README.md

slow

This bash script offers quick shortcuts to simulate slower network connections. It is useful when you need to simulate a wireless network on a Linux network server, especially when you are using a virtual machine guest on your local machine or in the cloud.

slow 3G                   # Slow network on default eth0 down to 3G wireless speeds
slow 3G -l 600ms -p 10%   # slow network on eth0 and setup latency to 600ms packetloss to 10%
slow reset                # Reset connection for default eth0 to normal
slow vsat --latency=500ms # Simulate satellite internet  with a high latency

slow dsl -b 1mbps # Simulate DSL with a slower speed than the default