Skip to content

Instantly share code, notes, and snippets.

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

nicerobot nicerobot

🤖
☯️ ☮️ 🐶 🐾 👾 🎮 🎼 🎶 🕺 🎧 🌻 🌱 🏞 🌊 🌔 🌎
View GitHub Profile
@nicerobot
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](https://www.ardanlabs.com/blog/2017/05/language-mechanics-on-escape-analysis.html).
bench:
go test -bench=. 2>&1 | tee bench.out
@nicerobot
nicerobot / README.md
Last active November 26, 2020 21:16
Simple demonstration of how nil pointers are not nil interfaces
@nicerobot
nicerobot / .inputrc
Last active November 17, 2020 22:26
For systems that aren't respecting special characters during blackward-kill-word
# Respect extended word-boundaries
set bind-tty-special-chars off
Control-u: kill-whole-line
Control-w: backward-kill-word
# Enable Alt- <- -> for jumping by words
"\e[1;5D": backward-word
"\eOd": backward-word
"\e[1;5C": forward-word
"\eOc": forward-word
@nicerobot
nicerobot / delete-activity.js
Last active June 6, 2022 16:39
JavaScript to Delete all (most) Facebook Activity as of 20201103
// 1. Navigate to your Activity Log
// 2. Paste this into the JavaScript Console
function clickDelete() {
document.querySelectorAll('[aria-label="Move to Trash"]')[0].click()
}
function clickMenu() {
document.querySelectorAll('[role="menuitem"]')[2].click();
setTimeout(clickDelete, 250);
}
@nicerobot
nicerobot / Makefile
Created August 21, 2020 01:38
A Makefile for Terraform
.PRECIOUS: output.json terraform.tfplan terraform.tfstate
output.json: terraform.tfstate
terraform output -no-color -json | tee $@
plan: terraform.tfplan
terraform.tfplan:
terraform plan -out $@
#!/bin/zsh
# expects https://github.com/ahmetb/kubectl-aliases
# implements lots of https://kubernetes.io/docs/reference/kubectl/cheatsheet/
alias kgpos='kgpo --sort-by=.metadata.creationTimestamp'
alias kgpoy='kgpo -o yaml'
### config view
alias kcv='k config'
  • SC1000 $ is not used specially and should therefore be escaped.
  • SC1001 This \o will be a regular 'o' in this context.
  • SC1003 Want to escape a single quote? echo 'This is how it'\''s done'.
  • SC1004 This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.
  • SC1007 Remove space after = if trying to assign a value (or for empty string, use var='' ... ).
  • SC1008 This shebang was unrecognized. ShellCheck only supports sh/bash/dash/ksh. Add a 'shell' directive to specify.
  • SC1009 The mentioned parser error was in ...
  • SC1010 Use semicolo
### 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
nicerobot / try.tf
Created May 29, 2020 15:28 — forked from karl-cardenas-coding/try.tf
Example of using try in Terraform
# Try example
data "http" "primary-server" {
url = "https://ip-ranges.amazonaws.com/ip-ranges.json"
# Optional request headers
request_headers = {
Accept = "application/json"
}
}