Skip to content

Instantly share code, notes, and snippets.

@disaac
disaac / bash-template
Created April 13, 2021 13:05 — forked from rkottmann/bash-template
A template bash script based on google style guide with some little improvements
#!/bin/bash
# Here short description of this script
# This is just a template to be used for writing new bash scripts
###
# Based on Google Style Guide: https://google.github.io/styleguide/shell.xml
# General remarks
# * Executables should have no extension (strongly preferred) or a .sh extension.
# * Libraries must have a .sh extension and should not be executable
@disaac
disaac / bash_get_options_template.sh
Created January 15, 2021 14:44 — forked from jefferys/bash_get_options_template.sh
A template for a bash function parsing CLI options and arguments into global variables, including short, long, repeated, counted, and --.
###############################################################################
# DESC: Parses arguments with the bash built-in getopts, but allows for
# long options too. This only works when each long option has a short option,
# although short options need not have long ones. Designed to create global
# variables named opt_<option> containing the parsed command line options, and
# an array variable called opt_args with any additional non-option arguments.
# This is all hard coded, but simple to modify for local use. See the ###
# sections for what needs to be changed to create your own option variable set.
# Supports bundled options and the use of "--" to signal end of options.
# Does not support negated options. You can always just declare "myFlag" and
@disaac
disaac / config.tf
Created February 14, 2020 18:02 — forked from kerr-bighealth/config.tf
iam-user module
terraform {
required_version = ">=0.12, <0.13"
}
@disaac
disaac / config.sh
Created February 3, 2020 18:52 — forked from joseluisq/config.sh
Bash script for executing MySQL query strings
# Database configuration
########################
# Use this file as database custom configuration file
DB_NAME='mydb'
DB_HOST='127.0.0.1'
DB_USER='usr'
DB_PASSWD='pwd'
@disaac
disaac / viscosity-to-ios-connect.rb
Created June 5, 2018 15:18 — forked from iMerica/viscosity-to-ios-connect.rb
Quickly convert all of your Viscosity connections into OVPN configuration files for OpenVPN for iOS (bundles certificates and keys in the files too)
Dir.glob("#{ENV['HOME']}/Library/Application Support/Viscosity/OpenVPN/*/config.conf").each do |file|
certificate_files = ['ca', 'cert', 'key', 'tls-auth']
config_dir = File.dirname(file)
connection_name = nil
new_config = []
File.read(file).lines.each do |line|
line.strip!
if line.start_with?('#viscosity name')