Skip to content

Instantly share code, notes, and snippets.

View a-nldisr's full-sized avatar
Pipe it to bash

Rogier Dikkes a-nldisr

Pipe it to bash
View GitHub Profile
a-nldisr /
Last active November 18, 2022 16:15
# This is the resource to create
module "config_generator" {
source = "" // ? usually point to github url or place on disk where the module exists
name = var.config_names
variable "config_names" {
type = list(any)
default = [
# Some containers do not provide netstat or lsof. This command will get you the local IP a session is established on
# In short: This gets the output from namespace 1 (where usually the process is running inside the container), filters out the field where the hex IP is located and converts it into a readable IP in the right format. (some fields are inverted etc)
# Benefit is that you dont need netstat installed to see connections.
printf '%d.%d.%d.%d\n' $(grep -v local /proc/1/net/tcp | awk '{print $2}'|cut -d: -f1| sed -r 's/(..)/0x\1 /g') | awk -F. '{for (i=NF; i>0; --i) printf "%s%s", (i<NF ? "." : ""), $i; printf "\n"}'
# This lists the connections that are established.
printf '%d.%d.%d.%d\n' $(grep -v rem /proc/1/net/tcp | awk '{print $3}'|cut -d: -f1| sed -r 's/(..)/0x\1 /g') | awk -F. '{for (i=NF; i>0; --i) printf "%s%s", (i<NF ? "." : ""), $i; printf "\n"}'
a-nldisr /
Last active May 21, 2024 21:00
Keybase CP script.
#!/usr/bin/env bash
# Script created by Rogier Dikkes.
# This script is licensed under the GNU GPL version 3.0.
# This script is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
a-nldisr / gist:df268155cc52b146853304caefde0bfd
Last active April 20, 2021 07:37
Setup private repo in Rancher Chart repository
Rancher only supports specific SSH key formats. When you try to add a ssh-key it often will fail and give the following error because the format is incorrect:
data does not contain a valid RSA or ECDSA private key
This issue gave the idea that the Rancher interface has limited SSH key support:
Generate the private key and public key:
ssh-keygen -t rsa -b 4096 -m pem -C "Rancher chart ssh-key"
Since there is no password option in the Rancher interface, provide the keys without a passphrase and place the keys to a location of your choice.
Test the key against Github to validate it is correct:
ssh-agent bash -c 'ssh-add /Users/USERNAME/.ssh/id_rsa_rancher_chart; git clone'
# Attach the public ELBs to the instance if they change
resource "aws_elb_attachment" "default" {
depends_on = [var.elb_depends_on]
for_each = toset(local.instance_ids)
elb =
instance = each.value
changed: [] => (item={'changed': False, 'stat': {'exists': False}, 'invocation': {'module_args': {'path': '/Users/rogierdikkes/Git/ansible/roles/role/handlers', 'follow': False, 'get_md5': False, 'get_checksum': True, 'get_mime': True, 'get_attributes': True, 'checksum_algorithm': 'sha1'}}, 'failed': False, 'item': {'dest': 'handlers'}, 'ansible_loop_var': 'item'}) => {
"ansible_loop_var": "item",
"changed": true,
- name: 'Verify if directories already exists'
path: "{{ playbook_dir }}/roles/{{ new_role_name }}/{{item.dest}}"
register: folder_stats
- { dest: "tasks" }
- { dest: "templates" }
- { dest: "defaults" }
- { dest: "handlers" }
- name: 'Register Test VPC into a var'
"tag:Name": test-vpc
register: vpctest
# You probably need to change the IP for something at your side
- name: 'Creating Customer Gateway'
- name: set up VPN with tunnel options utilizing 'TunnelInsideCidr' only
state: present
vpn: vpn-XXXXXXXX
static_only: true
TunnelInsideCidr: ''
cat >> ./file1.text <<EOF
cat >> ./file2.text <<EOF