Skip to content

Instantly share code, notes, and snippets.

View raphapr's full-sized avatar

Raphael Ribeiro raphapr

View GitHub Profile
@brikis98
brikis98 / main.tf
Last active March 14, 2023 23:43
A hacky way to create a dynamic list of maps in Terraform
# The goal: create a list of maps of subnet mappings so we don't have to statically hard-code them in aws_lb
# https://www.terraform.io/docs/providers/aws/r/lb.html#subnet_mapping
locals {
# These represent dynamic data we fetch from somewhere, such as subnet IDs and EIPs from a VPC module
subnet_ids = ["subnet-1", "subnet-2", "subnet-3"]
eips = ["eip-1", "eip-2", "eip-3"]
}
# Here's the hack! The null_resource has a map called triggers that we can set to arbitrary values.
# We can also use count to create a list of null_resources. By accessing the triggers map inside of
@jmlsf
jmlsf / js-in-cljs.md
Last active January 25, 2024 23:15
Using JavaScript modules in ClojureScript

Using JavaScript Libraries from ClojureScript

Using JavaScript libraries from ClojureScript involves two distinct concerns:

  1. Packaging the code and delivering it to the browser
  2. Making ClojureScript code that accesses JavaScript libraries safe for advanced optimization

Right now, the only single tool that solves these probems reliably, optimally, and with minimal configuration is shadow-cljs, and so that is what I favor. In paricular, shadow-cljs lets you install npm modules using npm or yarn and uses the resulting package.json to bundle external dependencies. Below I describe why, what alternatives there are, and what solutions I disfavor at this time.

Packaging and Delivering Code

@raphapr
raphapr / ldap_send_metrics.sh
Last active July 29, 2017 01:57
Sends LDAP (389 DS) metrics to Librato
#!/bin/bash
# It sends LDAP (389 DS) metrics to Librato
# Install shellbrato:
# git clone https://github.com/djosephsen/shellbrato.git
# sudo cp -a shellbrato /opt
source /opt/shellbrato/shellbrato.sh
function fish_mode_prompt --description 'Displays the current mode'
# Do nothing if not in vi mode
if test "$fish_key_bindings" = "fish_vi_key_bindings"
switch $fish_bind_mode
case default
set_color --bold red
echo 🅽
case insert
set_color --bold green
echo 🅸
anonymous
anonymous / output.csv
Created July 5, 2016 17:41
execution execution_time
1.0 10.418839779
2.0 2.811594338
3.0 2.816732824
4.0 2.727546294
5.0 2.883877956
6.0 3.701276362
7.0 3.053762709
8.0 2.782858096
9.0 2.800512036
anonymous
anonymous / output.csv
Created July 5, 2016 08:17
execution execution_time
1.0 10.046566281
2.0 2.942989441
3.0 2.6879393
4.0 2.79005592
5.0 2.694789332
6.0 2.63281678
7.0 2.683137688
8.0 2.67085224
9.0 2.738798621
@andreicristianpetcu
andreicristianpetcu / ansible-summary.md
Created May 30, 2016 19:25
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

# For further information about options in this file see:
# http://docs.mopidy.com/
#
# The initial commented out values reflect the defaults as of:
# Mopidy 0.18.3
# Mopidy-HTTP 0.18.3
# Mopidy-Local 0.18.3
# Mopidy-MPD 0.18.3
# Mopidy-Stream 0.18.3
#
#!/bin/bash
mkdir -p /opt/julia_0.4.5 && \
curl -s -L https://julialang.s3.amazonaws.com/bin/linux/x64/0.4/julia-0.4.5-linux-x86_64.tar.gz | tar -C /opt/julia_0.4.5 -x -z --strip-components=1 -f -
ln -fs /opt/julia_0.4.5 /opt/julia
echo "PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/julia/bin\"" > /etc/environment && \
echo "export PATH" >> /etc/environment && \
echo "source /etc/environment" >> /root/.bashrc
echo "source /etc/environment" >> ~/.bashrc
@raphapr
raphapr / .tmux.conf
Last active June 29, 2020 15:24
tmux conf general
## unind some default keybindings
unbind C-b
## set prefix key to ctrl-a
set -g prefix C-a
# CTRL+a a to return beginning of line
bind a send-prefix
# bind r to reloading the config file