Skip to content

Instantly share code, notes, and snippets.

View sebbrandt87's full-sized avatar
🇺🇦 🕊️ 🇮🇱 🕊️

Sebastian Brandt sebbrandt87

🇺🇦 🕊️ 🇮🇱 🕊️
View GitHub Profile
@sebbrandt87
sebbrandt87 / network_test.sh
Created March 27, 2022 10:21 — forked from popmonkey/network_test.sh
EdgeOS ready script that tests for WAN connection degradation (via packet loss and latency checks)
#!/bin/sh
#
# USG and EdgeRouter route-test script for failover
#
# uses ping to check latency and packet loss.
# returns zero when within thresholds and non zero (1) when above thresholds
# uses ping, traceroute, and logger
#
# by https://github.com/popmonkey
#
@sebbrandt87
sebbrandt87 / alert.sh
Created June 12, 2020 16:01 — forked from cherti/alert.sh
send a dummy alert to prometheus-alertmanager
#!/bin/bash
name=$RANDOM
url='http://localhost:9093/api/v1/alerts'
echo "firing up alert $name"
# change url o
curl -XPOST $url -d "[{
\"status\": \"firing\",
@sebbrandt87
sebbrandt87 / alert.sh
Created June 12, 2020 16:01 — forked from cherti/alert.sh
send a dummy alert to prometheus-alertmanager
#!/bin/bash
name=$RANDOM
url='http://localhost:9093/api/v1/alerts'
echo "firing up alert $name"
# change url o
curl -XPOST $url -d "[{
\"status\": \"firing\",
@sebbrandt87
sebbrandt87 / db_2_structs.go
Created February 25, 2018 22:31 — forked from itsbalamurali/db_2_structs.go
Reverse your MySQL Schema to Golang Structs
package main
import (
"fmt"
"log"
"os"
"strconv"
"github.com/Shelnutt2/db2struct"
"github.com/jinzhu/gorm"
@sebbrandt87
sebbrandt87 / golang-tls.md
Created February 25, 2018 22:30 — forked from itsbalamurali/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@sebbrandt87
sebbrandt87 / net_ldap_overrides.rb
Created July 3, 2017 06:14 — forked from mintuhouse/net_ldap_overrides.rb
Verify the certificate of secure LDAP server using net-ldap ruby gem
class Net::LDAP
def initialize(args = {})
@host = args[:host] || DefaultHost
@port = args[:port] || DefaultPort
@verbose = false # Make this configurable with a switch on the class.
@auth = args[:auth] || DefaultAuth
@base = args[:base] || DefaultTreebase
encryption args[:encryption] # may be nil
@sebbrandt87
sebbrandt87 / haproxy.cfg
Created May 3, 2017 06:09 — forked from ryzy/haproxy.cfg
HAProxy - essentials for HTTP/2
frontend https-in
mode tcp
bind *:443 ssl crt /etc/ssl/dummy.pem alpn h2,http/1.1
use_backend nodes-http2 if { ssl_fc_alpn -i h2 }
default_backend nodes-http
backend nodes-http
server node1 web.server:80 check
backend nodes-http2
// Let jenkins know that you want to execute the commands on a dedicated jenkins slave
node('dockerSlave') {
def mvnHome = tool 'M3'
// Cleanup local checkout - TODO there should also be a dedicated jenkins command to invoke this action
sh "rm -rf *"
sh "rm -rf .git"
// Clone from git
checkout scm
// Checkout specific local branch
checkout([$class: 'GitSCM', branches: [[name: '*/master']],
@sebbrandt87
sebbrandt87 / README.md
Created February 11, 2017 21:55 — forked from warmfusion/README.md
Cloud Init script for building a coreos cluster at home on XenServer using Cloud-Init and ETCD2

This Cloud-init script can be used to bootstrap a Xen based CoreOS server through Xen orchestra.

Features;

  1. Workaround for the lack of /etc/environment on 'unsupported' hypervisors
  2. Static IP allocation to deal with dhcp causing problems (On my network at least)
  3. etcd2 bootstrap discovery using public service and discovery tokens
    1. Manual reconfiguration to allow for membership changes after cluster is operational

Usage

@sebbrandt87
sebbrandt87 / knife cheat
Created January 11, 2017 08:13 — forked from ipedrazas/knife cheat
Hello!
# knife cheat
## Search Examples
knife search "name:ip*"
knife search "platform:ubuntu*"
knife search "platform:*" -a macaddress
knife search "platform:ubuntu*" -a uptime
knife search "platform:ubuntu*" -a virtualization.system
knife search "platform:ubuntu*" -a network.default_gateway