This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ---------------------------------------------------------------------------------------------------------- | |
# PURPOSE: Creates a byte array for use with DHCP Option 119 | |
# | |
# VERSION DATE USER DETAILS | |
# 1 07/03/2016 Craig Tolley First version | |
# 1.1 08/03/2016 Craig Tolley Fixed issue where if the whole domain matched the pointer was incorrect | |
# 1.2 08/03/2017 Craig Tolley Fixed further issues where the whole domain was matched the pointers are incorrect | |
# Modified outputs and tidied some formatting | |
# Convert-StringToOpt119Hex option fixed to not return values for null/empty strings | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install: put this in an executable file named `kubectl-decode_secret` , which is in your PATH | |
# Usage: kubectl decode-secret <secret-name> | |
# | |
# Note: the script is using fzf (https://github.com/junegunn/fzf) , for example if you just type `kubectl decode-secret` | |
# it will list the screts and you can select whichever you want | |
kubectl get secret $(kubectl get secret | sed 1d | fzf | awk '{ print $1 }') --template='{{ range $key, $value := .data }}{{ printf "%s: %s\n" $key ($value | base64decode) }}{{ end }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configurare GRE tunel (VPN) on Ubuntu Linux | |
# There are two ubuntu servers acting as routers on their own LAN networks 172.18.17.0/24 , 172.18.18.0/24 respectively | |
# Each of the servers also have public IP address | |
# configure /etc/network/interfaces on the servers adding *gre1* interface | |
#Ubuntu1 - 192.168.168.1/30 is the local IP address on the gre1 interface , this IP will comunicate with the remote gre1 tunnel interface for routing | |
# - <post-up> command: 172.18.18.0/24 which is the remote LAN is routed through the tunnel to 192.168.168.2 | |
auto gre1 | |
iface gre1 inet tunnel | |
address 192.168.168.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from passlib.totp import TOTP | |
from ansible.module_utils._text import to_text | |
class FilterModule(object): | |
def filters(self): | |
return { | |
'totpcode': self.totpcode | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
### Author: Alex Duzsardi | |
### Twitter: @aduzsardi | |
### GitHub: @aduzsardi | |
### Keybase: @aduzsardi | |
### Requirements: bash, date, docker, jq | |
# Remove docker volumes last used more than a month ago |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### | |
### my-script — does one thing well | |
### | |
### Usage: | |
### my-script <input> <output> | |
### | |
### Options: | |
### <input> Input file to read. | |
### <output> Output file to write. Use '-' for stdout. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Do this on each swarm-node | |
# store containers attached to the bridge | |
$ gwbridge_users=$(docker network inspect --format '{{range $key, $val := .Containers}} {{$key}}{{end}}' docker_gwbridge | \ | |
$ xargs -d' ' -I {} -n1 docker ps --format {{.Names}} -f id={}) | |
# stop all containers | |
# if you have stacks that restart automatically, remove them via docker stack <stackName> rm | |
$ echo "$gwbridge_users" | xargs docker stop | |
$ docker network rm docker_gwbridge | |
$ docker network disconnect -f docker_gwbridge gateway_ingress-sbox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker node inspect self --format '{{json .}}' | jq . | |
{ | |
"ID": "misdcojgeuz8ps4v1w93apoiz", | |
"Version": { | |
"Index": 443 | |
}, | |
"CreatedAt": "2020-08-08T21:58:17.93412711Z", | |
"UpdatedAt": "2020-08-15T12:15:50.442472266Z", | |
"Spec": { | |
"Labels": {}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add this to your .bashrc | |
# call it with httproxy http://proxied-url.tld | |
httproxy() { | |
local bold='\e[1m' reset='\e[0m' bright='\e[37m' | |
local info='\e[96m' warn='\e[93m' error='\e[91m' | |
local helpmsg=$(cat <<HELP | |
${info}Usage:${reset} | |
${bright}${FUNCNAME[0]} <proxied-url>${reset} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Based on https://stackoverflow.com/questions/20762575/explanation-of-convertor-of-cidr-to-netmask-in-linux-shell-netmask2cdir-and-cdir | |
mask2cdr () | |
{ | |
local mask=$1 | |
# In RFC 4632 netmasks there's no "255." after a non-255 byte in the mask | |
local left_stripped_mask=${mask##*255.} | |
local len_mask=${#mask} |
NewerOlder