Skip to content

Instantly share code, notes, and snippets.

View Almenon's full-sized avatar

Almenon Almenon

View GitHub Profile
@Almenon
Almenon / test
Created April 13, 2024 17:23
test
26473722532523467899555
@Almenon
Almenon / terraform.md
Last active January 13, 2023 22:14
Learn terraform in y minutes

Adapted from adambard/learnxinyminutes-docs#3949

Introduction

HCL (Hashicorp Configuration Language) is a high-level configuration language used in tools from Hashicorp (such as Terraform). HCL/Terraform is widely used in provisioning cloud infastructure and configuring platforms/services through APIs. This document focuses on a most recent HCL syntax (0.13).

HCL is a declarative language and terraform will consume all *.tf in the current folder, so code placement order and sequence has no significance. Sub-folders can be consumed through modules.

{ "key": "ctrl+1", "command": "workbench.action.openEditorAtIndex1" },
{ "key": "ctrl+2", "command": "workbench.action.openEditorAtIndex2" },
{ "key": "ctrl+3", "command": "workbench.action.openEditorAtIndex3" },
{ "key": "ctrl+4", "command": "workbench.action.openEditorAtIndex4" },
{ "key": "ctrl+5", "command": "workbench.action.openEditorAtIndex5" },
{ "key": "ctrl+6", "command": "workbench.action.openEditorAtIndex6" },
{ "key": "ctrl+7", "command": "workbench.action.openEditorAtIndex7" },
{ "key": "ctrl+8", "command": "workbench.action.openEditorAtIndex8" },
{ "key": "ctrl+9", "command": "workbench.action.openEditorAtIndex9" },
{ "key": "alt+8", "command": "workbench.action.focusEighthEditorGroup" },
@Almenon
Almenon / node_buffer_issue_python_script.py
Created May 19, 2020 04:58
node_buffer_issue_python_script
import sys
from time import sleep
# numBytes = 2 ** 29
# sys.stdout.write("a" * numBytes)
# only one flush
# sys.stdout.write("a")
# sys.stdout.flush()
# sleep(0.000000000000001)
import { spawn } from "child_process"
// 8192*2 (16384 aka 16KB) is the highWaterMark (aka buffer size?)
const node_process = spawn("node", ["-e", "process.stdout.write('a'.repeat(8192*2+1));setTimeout(()=>{console.log('done')},4000)"])
node_process.on('error', err => console.error(err))
let numFlushes = 0
node_process.stdout.on('data', (buffer: Buffer) => {
numFlushes += 1
@Almenon
Almenon / how_to_program.py
Created October 15, 2019 04:33
how to program, the basics
from arepl_dump import dump
#$end
# The first part of programming is simply declaring your variables
# This is very similar to math
x = 1
my_cool_number = 1+1
# my cool number = 1+1 # this doesn't work, no spaces allowed!
z = 2*2
@Almenon
Almenon / gist:f07ec9f581796c3a604b75a1ebc30749
Last active February 3, 2022 04:31
vscode mac keybindings
// Place your key bindings in this file to overwrite the defaults
[{
"key": "ctrl+shift+f",
"command": "workbench.action.tasks.runTask",
"args": "npmRunStart"
},
{ "key": "ctrl+shift+down", "command": "cursorColumnSelectDown",
"when": "editorTextFocus" },
{ "key": "ctrl+shift+up", "command": "cursorColumnSelectUp",
"when": "editorTextFocus" },
@Almenon
Almenon / .bash_aliases
Last active November 30, 2023 09:21
My aliases
alias logout="exit"
alias rm="rm -I"
alias cp="cp -i"
alias mv="mv -i"
alias users="cut -d : -f 1 /etc/passwd"
alias packages="dpkg --list"
alias programs="dpkg --list"
alias cwd=pwd
alias demons="ps -eo 'tty,pid,comm' | grep ^?"
alias daemons="ps -eo 'tty,pid,comm' | grep ^?"
@Almenon
Almenon / gist:1ad4a4d42ef1f8eb007d1289a6fcac0e
Last active January 14, 2021 18:01
boot problem notes
========================================================
= BACKSTORY
========================================================
I got a new SSD for my windows 10 home desktop computer recently. I used macrium to clone the HDD -> SSD and changed bios to boot from SSD.
But when I tried cleaning the HDD I somehow corrupted something in the windows boot process (no idea how it happened, I never even touched my SSD).
When I start windows I get error code 0xc000000e (A required device isn't connected or can't be accessed), so I have to go into recovery mode.
Most people online fix this by using bootrec, or worst case scenario bootsect. Nothing works for me.