Skip to content

Instantly share code, notes, and snippets.

View rayjanoka's full-sized avatar

Ray rayjanoka

View GitHub Profile
@Kenterfie
Kenterfie / terradiff
Created August 1, 2023 18:43
Small python script to make terraform plan outputs for terraform helm_release values better readable
#!/bin/env python3
#
# TERRADIFF
#
# Small script to convert EOT diffs into single line diffs to make them easier to read
#
# How to use
# terraform plan | terradiff
#
@vyaslav
vyaslav / add_to_bashrc.sh
Created October 10, 2020 19:32
aliases for kubectl with autocomplete
source <(kubectl completion bash)
__start_kubectl_cust()
{
local cur prev words cword
declare -A flaghash 2>/dev/null || :
if declare -F _init_completion >/dev/null 2>&1; then
_init_completion -s || return
else
__kubectl_init_completion -n "=" || return
fi
@Kangaroux
Kangaroux / gist:46bb853f13a637c071b1f890e1217724
Created July 16, 2020 01:24
Disable automatic audio device switching for linux, ubuntu (USB, controller, dualshock)
# If you want to stop your system from automatically switching audio devices,
# there is a simple edit to your PulseAudio config to disable that feature.
# Open PulseAudio config
sudo vim /etc/pulse/default.pa
# Comment out the line with "load-module module-switch-on-connect"
# Restart PulseAudio
pulseaudio -k
@janfri
janfri / gist:a3e61731864a63554ba6f32bdc7179aa
Last active June 13, 2024 15:19
Install sqlite-pcre on OSX
brew install sqlite pcre
git clone https://github.com/ralight/sqlite3-pcre.git
cd sqlite3-pcre
cc -shared -o pcre.so -I/usr/local/opt/pcre/include -fPIC -W -Werror pcre.c -L/usr/local/opt/pcre/lib -lpcre
echo ".load '`pwd`/pcre.so'" >> ~/.sqliterc
@milesbxf
milesbxf / monzo-alertmanager-config.yaml
Last active July 17, 2024 12:51
Monzo's Alertmanager Slack templates
###################################################
##
## Alertmanager YAML configuration for routing.
##
## Will route alerts with a code_owner label to the slack-code-owners receiver
## configured above, but will continue processing them to send to both a
## central Slack channel (slack-monitoring) and PagerDuty receivers
## (pd-warning and pd-critical)
##
@innovia
innovia / lambda-concurrency-to-cloudwatch.py
Created December 17, 2017 09:30
Lambda concurrent execution custom metric on CloudWatch
#!/usr/bin/env python
import boto3
import datetime
import time
ENABLED_REGIONS = [
"us-east-1",
"us-west-2",
"eu-west-1",
"eu-central-1",
@stefanprodan
stefanprodan / go-ssh-encrypted-pem.go
Created April 10, 2017 10:37
Using golang ssh client with an encrypted private key
package main
import (
"crypto/x509"
"encoding/pem"
"errors"
"fmt"
"golang.org/x/crypto/ssh"
"io/ioutil"
"net"
@itod
itod / split_keyboards.md
Last active June 12, 2024 12:08
Every "split" mechanical keyboard currently being sold that I know of
@lwoodson
lwoodson / install-json2yaml.bash
Last active August 10, 2022 15:57
Convert JSON to YAML via stdin (Ruby)
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o xtrace
sudo cat > /usr/local/bin/json2yaml <<EOT
#!/usr/bin/env ruby
require 'json'
require 'yaml'
@narainsagar
narainsagar / nodejs - get filesize in readable format.md
Last active January 14, 2022 05:33
node.js - function to get file and convert the file size in humanly readable format.

node.js - get the filesize in human readable format.

This will take filePath as a function parameter and reads the file via fs module and get the file and converts it's size into more humanly readable format.

const fs = require('fs');
function getFileSize(filename) {
  const stats = fs.statSync(filename);
  //console.log('stats', stats);
 const {size} = stats;