Skip to content

Instantly share code, notes, and snippets.

View bencord0's full-sized avatar

Ben Cordero bencord0

View GitHub Profile
@bencord0
bencord0 / provider.tf
Created June 20, 2022 18:22
Extracting secret environment variables from Terraform Cloud
terraform {
backend "remote" {
hostname = "app.terraform.io"
organization = "secret-org"
workspaces {
name = "secret-workspace"
}
}
@bencord0
bencord0 / reset.sh
Last active June 7, 2022 01:32
Reset branch
#!/bin/bash
# Resets the `staging` branch to the contents of the `production` branch,
# all while maintaining history of both trees, harshly.
PRODUCTION="${1}"
STAGING="${2}"
if [ -z "${PRODUCTION}" -o -z "${STAGING}" ]; then
echo "Usage: reset.sh <production> <staging>"
@bencord0
bencord0 / sealvalue.go
Created December 27, 2021 16:44
Seal a value for a github action secret
package main
import (
"encoding/base64"
"fmt"
"golang.org/x/crypto/nacl/box"
)
func main() {
plaintext := "hello"
@bencord0
bencord0 / openstack.guestfs
Last active September 30, 2021 21:26
Custom Gentoo Openstack Images
#!/usr/bin/guestfish -f
!echo "Modifying gentoo-openstack.qcow2"
# Fetch the image from the mirrors.
# wget -O gentoo-openstack.qcow2 \
# https://distfiles.gentoo.org/experimental/amd64/openstack/gentoo-openstack-amd64-systemd-latest.qcow2
add gentoo-openstack.qcow2
!echo "Starting libguestfs"
@bencord0
bencord0 / update_typora.py
Last active September 29, 2021 11:51
A script to update VSCode on linux (which has no autoupdater)
import os
import re
import requests
import tarfile
from pathlib import Path
from tqdm import tqdm
from urllib.parse import urlparse
INDEX_URL = "https://nodejs.org/dist/index.json"
FETCH_URL = 'https://nodejs.org/dist/{version}/node-{version}-linux-x64.tar.xz'
@bencord0
bencord0 / Dockerfile
Created June 16, 2021 08:55
Dockerfail
FROM ubuntu
RUN exit 1 | cat
RUN echo "Hello World"
@bencord0
bencord0 / emerge--info
Created April 5, 2021 18:11
portage on debian?!
root@2c7ec00cedc7:/# emerge --info
Portage 3.0.18 (python 3.7.3-final-0, embedded, gcc-8, unavailable, 5.10.4-gentoo x86_64)
=================================================================
System uname: Linux-5.10.4-gentoo-x86_64-with-debian-10.9
Timestamp of repository gentoo: Mon, 05 Apr 2021 00:45:01 +0000
Head commit of repository gentoo: f3f73a67dccda8e0d848f92ee1682fa0749f5088
sh sh
ld GNU ld (GNU Binutils for Debian) 2.31.1
Repositories:
@bencord0
bencord0 / build_kernel.sh
Created November 10, 2020 20:39
How to build a kernel
#!/bin/bash
set -ex
KVER="$(make -s -C "${BUILD_DIR}" kernelversion 2>/dev/null)"
BUILD_DIR="/usr/src/build-${KVER}"
SRC_DIR=/usr/src/linux
function copy_config() {
mkdir -vp "${BUILD_DIR}"
@bencord0
bencord0 / .gitignore
Last active September 4, 2020 22:10
Hello World Without Webpack
index.js
@bencord0
bencord0 / Makefile
Last active August 23, 2020 12:05
crossdev musl
# Set the compiler toolchain to musl-gcc
# In gentoo, create the toolchain with crossdev
#
# crossdev -t x86_64-pc-linux-musl -S
#
CC = x86_64-pc-linux-musl-gcc
# The toolchain sets the ELF Interpreter to /lib/ld-musl-x86_64.so.1
# Either, set the interpreter in the binary to the musl dynamic loader,
# which is the same file as the libc, or symlink the expected loader.