Skip to content

Instantly share code, notes, and snippets.

View plasticine's full-sized avatar
🐧
Hello? Is this thing on?

Justin Morris plasticine

🐧
Hello? Is this thing on?
View GitHub Profile
@optiz0r
optiz0r / Caddyfile.tmpl
Created April 29, 2021 07:35
Caddy with Nomad + Consul
{{- range services -}}
{{- if .Name | contains "sidecar" | not -}}
{{- $groupedServices := (service .Name | byMeta "caddy_enable") -}}
{{- $enabledServices := (index $groupedServices "true" ) -}}
{{- range $enabledServices -}}
{{- $vhost := index .ServiceMeta "caddy_vhost" -}}
{{- scratch.MapSetX "vhosts" $vhost . -}}
{{- end -}}
{{- end -}}
{{- end -}}
@mocobeta
mocobeta / Dockerfile-0.1.0
Last active May 25, 2022 16:39
Configuring Elasticsearch 7 cluster on GKE
FROM docker.elastic.co/elasticsearch/elasticsearch:7.7.0
ENV PATH /usr/share/elasticsearch/bin:$PATH
# switch user to elasticsearch
USER elasticsearch
# install plugins
RUN elasticsearch-plugin install analysis-kuromoji
@carterbryden
carterbryden / AddPostgresTriggerAndFunctionForAllTables.exs
Last active August 30, 2024 19:17
Elixir Phoenix Postgresql migration to add triggers for pubsub to run on every CRUD operation on every table. If a new table is added, it'll automatically add a trigger to that table too.
defmodule MyApp.Repo.Migrations.AddPostgresTriggerAndFunctionForAllTables do
use Ecto.Migration
def up do
# Create a function that broadcasts row changes
execute "
CREATE OR REPLACE FUNCTION broadcast_changes()
RETURNS trigger AS $$
DECLARE
current_row RECORD;
@s8sg
s8sg / NetworkingFirecracker.md
Last active October 18, 2024 20:22
Networking with Firecracker

Create Bridge interface on the host and give internet access

sudo ip link add name br0 type bridge
sudo ip addr add 172.20.0.1/24 dev br0
sudo ip link set dev br0 up
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables --table nat --append POSTROUTING --out-interface enp3s0 -j MASQUERADE
sudo iptables --insert FORWARD --in-interface br0 -j ACCEPT

Create a tap device and link to the bridge

@s8sg
s8sg / MountVolumeFirecracker.md
Last active February 13, 2022 23:33
Volume Mount Firecracker

Create qcow image

qemu-img create -f qcow2 file.qcow2 100M
sudo mkfs.ext4 file.qcow2

Add drive it to the MicroVM

--add-drive=file.qcow2:rw
@sethvargo
sethvargo / README.md
Last active October 12, 2018 19:38
A simple script for installing most HashiCorp tools (with GPG verification)
@enricofoltran
enricofoltran / main.go
Last active October 3, 2024 14:08
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@robrichard
robrichard / react-relay.js
Created November 1, 2017 16:40
Mock for relay modern
import React from 'react';
import PropTypes from 'prop-types';
const relayMock = jest.genMockFromModule('react-relay');
const relayChildContextTypes = {
relay: PropTypes.object
};
const relayEnvironment = {
lookup: jest.fn()

Head Over Heels for Snapshot Testing

Tests are interesting, because you're trying to test code. But to write tests, you have to write code. Who tests the tests? For tests to be worth it you need to be sure that for each line of code you add, the value being added is more than the liability.

Value > Liability

Because belive me, tests are a liability. First, they are code that

@cyberang3l
cyberang3l / How to setup VirtualGL and TurboVNC on Ubuntu.md
Last active December 18, 2024 08:59
Setup VirtualGL and TurboVNC on Ubuntu for OpenGL forwarding