Skip to content

Instantly share code, notes, and snippets.

View nicerobot's full-sized avatar
☯️ ☮️ 🐶 🐾 👾 🎮 🎼 🎶 🕺 🎧 🌻 🌱 🏞 🌊 🌔 🌎

nicerobot nicerobot

☯️ ☮️ 🐶 🐾 👾 🎮 🎼 🎶 🕺 🎧 🌻 🌱 🏞 🌊 🌔 🌎
View GitHub Profile
nicerobot / Makefile
Last active February 22, 2021 13:02 — forked from teivah/pointer_test.go
Notice that the issue is with returning a pointer, not with passing a pointer. Passing the pointer is indeed faster than passing the value, as expected. This discrepancy is likely the effect of [having to escape the pointer's data to the heap](
View Makefile
go test -bench=. 2>&1 | tee bench.out
### Test scenario for "can"
variable "word-length" {
validation {
# The condition here identifies if the integer if greater than 1
condition = var.word-length > 1
error_message = "The variable is not greater than 5. Word length has to be at a minimum > 1."
variable "os" {
default = "linux"
validation {
# The condition here identifies if the variable contains the string "linxu" OR "windows".
condition = can(regex("linux|windows", var.os))
error_message = "ERROR: Operating System must be Windows OR Linux."
nicerobot /
Created May 29, 2020 15:28 — forked from karl-cardenas-coding/
Example of using try in Terraform
# Try example
data "http" "primary-server" {
url = ""
# Optional request headers
request_headers = {
Accept = "application/json"
nicerobot /
Created April 26, 2020 17:25 — forked from posener/
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

nicerobot / locks.sql
Created April 21, 2019 20:32 — forked from varunchitale/locks.sql
Get a list of queries and their details that hold locks over relations in a dB.
View locks.sql
SELECT AS blocked_pid,
blocked_activity.usename AS blocked_user, AS blocking_pid,
blocking_activity.usename AS blocking_user,
blocked_activity.query AS blocked_statement,
blocking_activity.query AS current_statement_in_blocking_process,
blocked_activity.application_name AS blocked_application,
blocking_activity.application_name AS blocking_application
FROM pg_catalog.pg_locks blocked_locks
nicerobot / delete_duplicates.sql
Created April 21, 2019 20:32 — forked from varunchitale/delete_duplicates.sql
Efficiently delete duplicates rows from a table with a set of specific constraints.
View delete_duplicates.sql
SELECT MIN(ctid) as ctid, var1, var2
FROM <same_table> b
) b
WHERE a.var1 = b.var1
and a.var2 = b.var2
AND a.ctid <> b.ctid
nicerobot / .docker_aliases
Created December 26, 2018 03:17 — forked from cjus/.docker_aliases
Docker aliases
View .docker_aliases
alias dm='docker-machine'
alias dmx='docker-machine ssh'
alias dk='docker'
alias dki='docker images'
alias dks='docker service'
alias dkrm='docker rm'
alias dkl='docker logs'
alias dklf='docker logs -f'
nicerobot / .gitignore
Created October 27, 2018 19:14 — forked from pepasflo/.gitignore
Scripts for encrypting / decrypting secrets (to prevent them from being accidentally checked into git)
View ambassador.yaml
apiVersion: v1
kind: Service
service: ambassador
name: ambassador
type: LoadBalancer