Skip to content

Instantly share code, notes, and snippets.

View darkn3rd's full-sized avatar
🏠
Working from home

Joaquin Menchaca darkn3rd

🏠
Working from home
View GitHub Profile
@darkn3rd
darkn3rd / randpasswd_function.sh
Last active April 28, 2024 03:45
randpasswd bash function
randpasswd() {
NUM=${1:-32}
# macOS scenario
if [[ $(uname -s) == "Darwin" ]]; then
perl -pe 'binmode(STDIN, ":bytes"); tr/A-Za-z0-9//dc;' < /dev/urandom | head -c $NUM
else
# tested with: GNU/Linux, Cygwin, MSys
tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w $NUM | sed 1q
fi
@darkn3rd
darkn3rd / vault_dgraph_1.sh
Last active April 25, 2024 19:18
Vault Dgraph Part 1
mkdir ./{vault,dgraph}
cat << 'EOF' > compose.yml
services:
zero1:
image: dgraph/dgraph:${DGRAPH_VERSION}
command: dgraph zero --my=zero1:5080 --replicas 1 --raft idx=1
ports:
- 6080:6080
container_name: zero1
@darkn3rd
darkn3rd / instructions.md
Last active March 2, 2024 22:18
Consul Lab 0 - KodeKloud

Installation

Goal: Install Consul 1.17.0.

# INSTALL
# Source: https://developer.hashicorp.com/consul/downloads
wget -O- https://apt.releases.hashicorp.com/gpg \
  | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
@darkn3rd
darkn3rd / cpan.md
Last active January 22, 2024 11:48
Perl CPAN vs. CPANM

What is the difference between cpan and cpanm?

This was explanation by Grant McLean

CPAN CLI

cpan the CPAN shell has been shipped with Perl since about 1997. When you run it the first time it asks a bunch of questions and saves the answers in a config file. Then you can install a module by running:

cpan -i Module::Name

The shell provides other commands for searching CPAN and looking inside distribution files.

@darkn3rd
darkn3rd / provision.md
Last active January 4, 2024 08:30
Pedantic ADHD Guide to Kubernetes Provisioning

Pedantic ADHD Guide to Kubenretes Provisioning

This is my guide for how to get Kubernetes provisioned using Azure, Google Cloud, or AWS using CLI tools. This will require setting up an account with local CLI tools. The goal of this is to quickly set up a disposable test clusters in minimalist way.

The Tools

Some tools used here:

  • General
  • direnv (direnv) - used to setup environment variables automatically
@darkn3rd
darkn3rd / expecting.md
Created February 19, 2017 07:13 — forked from ksafranski/expecting.md
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect
@darkn3rd
darkn3rd / vagrantfile.rb
Last active September 13, 2023 17:46
Vagrantfile for Dynamic MultMachine
# -*- mode: ruby -*-
# vi: set ft=ruby :
# default constants
TIME = Time.now.strftime('%Y%m%d%H%M%S')
CONFIGFILE_HOSTS = './config/hosts'
VAGRANT_BOX = 'bento/ubuntu-14.04'
# build hosts hash
hosts = {}
@darkn3rd
darkn3rd / Arch-VirtualBox.md
Last active July 10, 2023 14:32
Arch Linux as VirtualBox Guest

ArchLinux Virtualbox STEP-by-STEP

These are my ArchLinux on Virtualbox notes with some added explanations.

  • Joaquin Menchaca (Nov 6, 2017)

Create Virtualbox System

This is handcrafted creation of using Virtualbox using defaults with these adjustments:

@darkn3rd
darkn3rd / get_eksctl_ebs_policy.sh
Created May 6, 2023 18:38
Get Inline Policy Attached to Node IAM Role
EKS_CLUSTER_NAME=${EKS_CLUSTER_NAME:-"my-cluster"}
NODE_GROUP=$(aws eks list-nodegroups \
--cluster-name $EKS_CLUSTER_NAME \
| jq -r '.nodegroups[0]'
)
ROLE_ARN=$(aws eks describe-nodegroup \
--cluster-name $EKS_CLUSTER_NAME \
--nodegroup-name $NODE_GROUP \
| jq -r '.nodegroup.nodeRole'
)
@darkn3rd
darkn3rd / prepare_iso_notes.md
Last active January 12, 2023 05:25
Mac OS X Prepare ISO

Prepare ISO Notes

These are notes on this process to prepare an install CD so that you can create a virtual Mac OS X. This is useful for testing scripts.

Prepare ISO Script

#!/bin/sh -e
#
# Preparation script for an OS X automated installation for use with VeeWee/Packer/Vagrant