Skip to content

Instantly share code, notes, and snippets.

View jamesdube's full-sized avatar
🛰️
To the moon

James Dube jamesdube

🛰️
To the moon
View GitHub Profile
@jamesdube
jamesdube / output
Created February 8, 2019 13:15 — forked from halberom/output
ansible - example of dict with array of arrays
PLAY [foo] ********************************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [role1 | debug var=redis] ***********************************************
ok: [localhost] => {
"redis": {
"database_save_times": [
[
@jamesdube
jamesdube / TODO
Created February 14, 2019 08:50 — forked from perrygeo/TODO
Ansible playbook for a full dev environment
TODO
implement security measures
git config
config files
full sublimetext config
set up openvpn
rdesktop and network drive to terra
set up evolution
RStudio
this.mockMvc.perform(post("/alerts")
.contentType(MediaType.APPLICATION_JSON_VALUE)
.content(mapper.writeValueAsString(request)))
.andDo(print())
.andExpect(status().isCreated())
.andExpect(jsonPath("$.success").value(true))
.andExpect(jsonPath("$.narrative").value("CLOSE ALERT WITH ID 989898989"));
@jamesdube
jamesdube / regex.txt
Last active February 5, 2024 14:29
Zimbabwe National ID Regex
# 00000000X00
/([0-9]{8,9}[a-z,A-Z][0-9]{2})/g
# 00-000000-X-00 dashes are optional
/([0-9]{2}-?[0-9]{6,7}-?[a-z,A-Z]-?[0-9]{2})/g
# 00-000000 X00 dash is required, space before letter is optional
/([0-9]{2}-[0-9]{6,7}\s?[a-z,A-Z][0-9]{2})/g
@jamesdube
jamesdube / sysctl.conf
Created October 5, 2019 21:40 — forked from voluntas/sysctl.conf
Sysctl configuration for high performance
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
@jamesdube
jamesdube / Readme.md
Created February 1, 2020 01:08 — forked from philipz/Readme.md
GitLab Runner on a Kubernetes cluster
  1. Create namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
  name: gitlab
  1. kubectl create -f ./namespace.yaml
@jamesdube
jamesdube / drain.sh
Created February 5, 2020 09:48
Drain Pods on Crashed Node
#!/bin/sh
KUBECTL="/usr/local/bin/kubectl"
# Get only nodes which are not drained yet
NOT_READY_NODES=$($KUBECTL get nodes | grep -P 'NotReady(?!,SchedulingDisabled)' | awk '{print $1}' | xargs echo)
# Get only nodes which are still drained
READY_NODES=$($KUBECTL get nodes | grep '\sReady,SchedulingDisabled' | awk '{print $1}' | xargs echo)
echo "Unready nodes that are undrained: $NOT_READY_NODES"
@jamesdube
jamesdube / composer_install.sh
Last active March 20, 2020 09:40
Script to install composer
#!/bin/sh
EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
@jamesdube
jamesdube / hide-mounted-drives.sh
Created May 7, 2020 18:11
Hide Mounted drives from dock
gsettings set org.gnome.shell.extensions.dash-to-dock show-mounts false
#!/usr/bin/env bash
set -e -o pipefail; [[ -n "$DEBUG" ]] && set -x
CERT_DIR="${CERT_DIR:-"/usr/local/share/ca-certificates"}"
function usage() {
echo "Usage: $(basename "$0") [-n clustername] certfile ..." >&2
}