Skip to content

Instantly share code, notes, and snippets.

@blakelead
blakelead / new-raylib-cpp-project.sh
Last active January 14, 2023 09:34
Create an empty Raylib and Box2D C++ project for MacOS
#! /bin/bash
# Enable xtrace if the DEBUG environment variable is set
if [[ ${DEBUG-} =~ ^1|yes|true$ ]]; then
set -o xtrace
fi
set -o errexit
APP_NAME=""
@blakelead
blakelead / random_csv_server.go
Last active November 8, 2024 20:28
Go server that serves CSV files with random data
package main
import (
"encoding/csv"
"fmt"
"io/ioutil"
"log"
"math/rand"
"net/http"
"os"
@blakelead
blakelead / img_gen.go
Last active October 30, 2020 19:26
Generate simple random images
package main
import (
"flag"
"fmt"
"image"
"image/color"
"image/png"
"log"
"math"
@blakelead
blakelead / config.yaml
Last active July 9, 2020 11:42
Learning reflection in go by mimicking yaml.Unmarshal
field: value
@blakelead
blakelead / encrypt_decrypt.gs
Created September 29, 2019 08:26
Encrypt decrypt strings with Google KMS
// decrypt function decrypts `cipherSecret` string with Google KMS
function Decrypt(project, location, keyring, key, cipherSecret) {
// parameters for the decryption http call
var params = {
"method" : "POST",
"contentType": "application/json",
"headers": { "Authorization": getOAuth2Token() },
"payload" : JSON.stringify({ "ciphertext": cipherSecret })
};
@blakelead
blakelead / mbp-shutdown-fix.md
Created September 7, 2019 11:30
Fix random shutdowns on Macbook Pro
  • csrutil disable in recovery mode (cmd+R on boot)
  • reboot
  • sudo mv /System/Library/Extensions/AppleThunderboltNHI.kext /System/Library/Extensions/AppleThunderboltNHI.kext.BAK
  • reboot
  • csrutil enable in recovery mode
@blakelead
blakelead / dl_station.sh
Last active December 12, 2019 21:12
Pause/Resume downloads for Synology Download Station
#!/bin/bash
NAS_URI=*.*.*.*:5000
LOGIN=user
PASSWORD=mypassword
ACTION=$1
if [[ "$ACTION" != "resume" && "$ACTION" != "pause" ]]; then
echo 'No action specified'
echo 'Usage: ./dl_station.sh pause/resume'
@blakelead
blakelead / jenkins.yml
Created February 27, 2019 20:29
Kubernetes file for complete Jenkins namespace
---
kind: Namespace
apiVersion: v1
metadata:
name: jenkins
labels:
name: jenkins
---
@blakelead
blakelead / Vagrantfile
Created January 9, 2019 20:03
Centos7 Vagrantfile with disk creation
# -*- mode: ruby -*-
# vi: set ft=ruby :
boxes = [
{
:name => "node01.local",
:eth => "192.168.10.10",
:mem => "2048",
:cpu => "2"
},