Skip to content

Instantly share code, notes, and snippets.

View nickcharlton's full-sized avatar
🐢

Nick Charlton nickcharlton

🐢
View GitHub Profile
@candlerb
candlerb / go-project-layout.md
Last active October 1, 2024 08:33
Suggestions for go project layout

If someone asked me the question "what layout should I use for my Go code repository?", I'd start by asking back "what are you building: an executable, or a library?"

Single executable

Stage 1: single source file

Create a directory named however you want your final executable to be called (e.g. "mycommand"), change into that directory, and create the following files:

@jferris
jferris / random-color
Created January 27, 2023 16:00
Generate a random color name
#!/bin/sh
set -e
colors() {
cat <<EOS
acid
aero
alabaster
alizarin
@merlinmann
merlinmann / wisdom.md
Last active August 1, 2024 01:08
Merlin's Wisdom Project (Draft)

Merlin's Wisdom Project

Or: “Everybody likes being given a glass of water.”

By Merlin Mann.

It's only advice for you because it had to be advice for me.

@jferris
jferris / configmap.yaml
Last active October 28, 2024 01:42
Rails Kubernetes Manifests
apiVersion: v1
kind: ConfigMap
metadata:
name: example
namespace: default
data:
APPLICATION_HOST: example.com
LANG: en_US.UTF-8
PIDFILE: /tmp/server.pid
PORT: "3000"
@reegnz
reegnz / README.md
Created June 19, 2020 10:39
CamelCase <--> snake_case conversion in jq

CamelCase <--> snake_case conversion with jq

tl;dr

I provide you with 3 jq lib functions that will help you in converting between snake_case and CamelCase.

The interface

I want to change keys in my json from camelcase to snake_case.

@coldclimate
coldclimate / monitoring-alerting-mvp.markdown
Last active August 2, 2023 16:42
WIP 101 what to monitor and alert on.

Monitoring and Alerting Minimum Viable Product

A checklist for those attempting to only get out of bed when it's important and to be able to debug critial and non-critial issues.

Those emphesised should probably get you out of bed when they're too high/low/gone.

This is super opinionated but I welcome feedback. It's biased to retrofitting/cleaning up/brownfield type work because that's what I know best.

HTTP(S) Services

@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active November 4, 2024 07:33
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@tvandervossen
tvandervossen / stimulus_notes.md
Last active May 5, 2018 09:21
Quick guide for people who want to add stimulus.js to a Rails 5.2 app but who haven’t used much Modern JavaScript

How to add stimulus.js to a Rails 5.2 app

This might also work or Rails 5.1, but I haven’t tried that yet.

Add the webpacker gem to your Gemfile:

# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker'

Then run (assuming you’re on macOS and using Homebrew):

#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/tessdata/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@jdarpinian
jdarpinian / executable.c
Last active May 30, 2024 19:42
Add one line to your C/C++ source to make it executable.
///$(which true);FLAGS="-g -Wall -Wextra --std=c17 -O1 -fsanitize=address,undefined";THIS_FILE="$(cd "$(dirname "$0")"; pwd -P)/$(basename "$0")";OUT_FILE="/tmp/build-cache/$THIS_FILE";mkdir -p "$(dirname "$OUT_FILE")";test "$THIS_FILE" -ot "$OUT_FILE" || $(which clang || which gcc) $FLAGS "$THIS_FILE" -o "$OUT_FILE" || exit $?;exec bash -c "exec -a \"$0\" \"$OUT_FILE\" $([ $# -eq 0 ] || printf ' "%s"' "$@")"
#include <stdio.h>
int main() {
printf("Hello world!\n");
return 0;
}