Skip to content

Instantly share code, notes, and snippets.

View davewongillies's full-sized avatar

Dave Wongillies davewongillies

View GitHub Profile
@davewongillies
davewongillies / Terraform_functions.md
Last active May 5, 2024 09:21
Terraform Functions

Supported built-in functions

  • abs(float) - Returns the absolute value of a given float. Example: abs(1) returns 1, and abs(-1) would also return 1, whereas abs(-3.14) would return 3.14. See also the signum function.

  • basename(path) - Returns the last element of a path.

  • base64decode(string) - Given a base64-encoded string, decodes it and returns the original string.

@davewongillies
davewongillies / How-to Use a serial connection to your Netgear ReadyNAS.md
Last active April 3, 2024 17:54
How-to: Use a serial connection to your Netgear ReadyNAS

Taken from http://damsteen.nl/blog/how-to-use-a-serial-connection-to-your-netgear-readynas as it always seems to be down

How-to: Use a serial connection to your Netgear ReadyNAS

It is possible to connect to the command-line interface of your Netgear ReadyNAS using a serial connection. I have seen a very old blog post on the internet describing how to connect via serial to a Infrant ReadyNAS NV but it wasn't very clear how to connect to a Netgear ReadyNAS NVX Pioneer Edition, which I have. I guess I'm not the only one who wants to connect to their ReadyNAS, so I'm sharing my knowlegde here :)

The obvious advantages of a serial connection to your ReadyNAS is that you can experiment with network settings without the fear of rendering your NAS inaccessible. I believe it is also possible to recover the firmware in the event an update fails, although I haven't tried this myself.

Requirements

@davewongillies
davewongillies / OpenSSL Cheatsheet.md
Last active December 28, 2023 13:06
OpenSSL Cheatsheet

General OpenSSL Commands

These commands allow you to generate CSRs, Certificates, Private Keys and do other miscellaneous tasks.

Generate a new private key and Certificate Signing Request

openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key

What do Etcd, Consul, and Zookeeper do?

  • Service Registration:
    • Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
  • Service Discovery:
    • Ability for client application to query the central registry to learn of service location.
  • Consistent and durable general-purpose K/V store across distributed system.
    • Some solutions support this better than others.
    • Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
  • Centralized locking can be based on this K/V store.
@davewongillies
davewongillies / Serving Django apps behind SSL with Nginx.md
Last active August 28, 2022 17:31 — forked from aj-justo/gist:3228782
Serving Django apps behind SSL with Nginx

Configuring Nginx to serve SSL content is straight forward, once you have your certificate and key ready:

server { 
    listen 443 default ssl;
    root /path/to/source;
    server_name mydomain;

    ssl_certificate      /path/to/cert;
    ssl_certificate_key  /path/to/key;
@davewongillies
davewongillies / tmux.md
Created April 22, 2016 11:09 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@davewongillies
davewongillies / aws_config.fish
Last active July 22, 2021 11:30 — forked from mbainter/aws_config.fish
Fish shell function to set your AWS credentials with MFA
function aws_config
if not fgrep -q "[$argv]" ~/.aws/credentials
echo "Please specify a valid profile."
else
set token_expired false
if test $AWS_SESSION_EXPIRY
set now (date +%s)
# WARNING: this date command only works with GNU date
@davewongillies
davewongillies / HOWTO.md
Last active August 20, 2020 04:23
Flashing a QMK Proton C for use in a SpaceCat Launch Pad
@davewongillies
davewongillies / davewongillies.json
Created July 6, 2020 23:39
kbdfans kbd67mkii layout
{
"author": "David Gillies",
"documentation": "",
"keyboard": "kbdfans/kbd67/mkii_soldered",
"keymap": "davewongillies",
"layers": [
[
"KC_GRV",
"KC_1",
"KC_2",
@davewongillies
davewongillies / sentry.conf.py
Created February 3, 2015 10:08
sentry.conf.py with redis sentinel
from redis.sentinel import Sentinel
sentinel = Sentinel([
('redis-sentinel1', 26379),
('redis-sentinel2', 26379),
('redis-sentinel3', 26379),
], socket_timeout=0.1)
redis_host = sentinel.discover_master('sentry')
SENTRY_REDIS_OPTIONS = {
'hosts': {