Skip to content

Instantly share code, notes, and snippets.

View hybridadmin's full-sized avatar

Tinashe Chikomo hybridadmin

View GitHub Profile
@hybridadmin
hybridadmin / 0 - setup
Created July 31, 2025 08:05 — forked from aserhat/0 - setup
QEMU and HVF
# Summary
A few notes I took to see if I could use MacOS as Hypevirsor in a similar fashion to Linux
I wanted to see how few addons were needed instead of using Parallels, Virtual Box, VM Fsion etc.
The idea is to use QEMU, Hypervisor Framework (https://developer.apple.com/documentation/hypervisor) and some custom host networking.
# Installations
brew install qemu (For controlling Hypervisor Framework)
brew install cdrtools (For making cloud init iso's)
http://tuntaposx.sourceforge.net/download.xhtml (For customer tap based networking)
@hybridadmin
hybridadmin / postgres-cheatsheet.md
Created October 11, 2021 17:16 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)

Install Android SDK CLI Ubuntu 20.04 WSL2 (Work in Progress)

Install Java 8

sudo apt install openjdk-8-jdk-headless

Android SDK

@hybridadmin
hybridadmin / vpc.yaml
Created July 21, 2021 09:28 — forked from milesjordan/vpc.yaml
Cloudformation template for a VPC with ipv6, with public and private subnets, calculating the subnet ipv6 CIDR blocks on the fly.
---
AWSTemplateFormatVersion: '2010-09-09'
Description: Public VPC and subnets
Resources:
#
# Public VPC
#
PublicVpc:
@hybridadmin
hybridadmin / vpc-fargate.yaml
Created July 20, 2021 11:53 — forked from lizrice/vpc-fargate.yaml
Cloudformation template for setting up VPC and subnets for Fargate
# Usage:
# aws cloudformation --region <region> create-stack --stack-name <stack name> --template-body file://vpc-fargate.yaml
# This template will:
# Create a VPC with:
# 2 Public Subnets
# 2 Private Subnets
# An Internet Gateway (with routes to it for Public Subnets)
# A NAT Gateway for outbound access (with routes from Private Subnets set to use it)
#
@hybridadmin
hybridadmin / purge.py
Created June 24, 2021 18:32
A purge script for Observium
#! /usr/bin/env python
"""
purge.py A small tool that allows you to easily purge old entries in the eventlog and syslog table
Author: Mathieu Poussin <mathieu.poussin@sodexo.com>
Date: Mar 2014
Usage: This program accepts many arguments :
--syslog : Enable the syslog table purge
--eventlog : Enable the eventlog table purge
@hybridadmin
hybridadmin / myscript
Created June 5, 2021 10:48 — forked from neatshell/myscript
simple bash template that handles mandatory and optional arguments
#!/bin/bash
script="myscript"
#Declare the number of mandatory args
margs=2
# Common functions - BEGIN
function example {
echo -e "example: $script -m0 VAL -m1 VAL -o1 -o2 VAL"
}
@hybridadmin
hybridadmin / gist:163adaf3dbce3ed4bdc1f5e76a9749c5
Last active June 4, 2021 12:46 — forked from rroemhild/gist:190970
simple shell script log function
# Vars for log()
LOGGER="/usr/bin/logger" # Path to logger
FACILITY="LOCAL2" # Syslog facility
PROG="´basename $0´" # Program name
SYSLOG="YES" # Write to Syslog? (YES/NO)
VERBOSE="YES" # Write to STDOUT? (YES/NO)
log(){
# Function: log()
# Usage: log priority "message"
@hybridadmin
hybridadmin / ansible-galaxy-find-role-id.sh
Created November 3, 2020 17:17 — forked from pavlov99/ansible-galaxy-find-role-id.sh
Find your role's id in ansible-galaxy
$ ansible-galaxy info YourUser.RoleName | grep -E 'id: [0-9]' | awk {'print $2'}
@hybridadmin
hybridadmin / valid_domain_name_regex
Created August 28, 2020 15:21 — forked from neu5ron/valid_domain_name_regex
Valid domain name regex including internationalized domain name
domain_regex = r'(([\da-zA-Z])([_\w-]{,62})\.){,127}(([\da-zA-Z])[_\w-]{,61})?([\da-zA-Z]\.((xn\-\-[a-zA-Z\d]+)|([a-zA-Z\d]{2,})))'
#Python
domain_regex = '{0}$'.format(domain_regex)
valid_domain_name_regex = re.compile(domain_regex, re.IGNORECASE)
self.domain_name = self.domain_name.lower().strip().encode('ascii')
if re.match(valid_domain_name_regex, self.domain_name ):
return True
else:
return False