Skip to content

Instantly share code, notes, and snippets.

@mcrumm
mcrumm / phx_sqlite_fly_launch.md
Last active August 26, 2024 08:44
Phoenix + SQLite Deployment tips

Deploying to Fly.io with SQLite

Deploying a Phoenix app to Fly.io is a breeze...is what everyone kept telling me. In fairness, I imagine the process would have been breezier had I just used postgres, but all the sqlite and litestream talk has been far too intriguing to ignore. "Wait", you say. "It is just a flat file. How much harder can it be?"

It is easy to make something harder than it should be. It is hard to take something complex and make it truly simple. flyctl launch does an amazing job at providing a simple interface to the utterly complex task of generating deployment resources, especially now that we are living in a containerd (erm, firecracker) world.

This gist is for anyone who, like me, thinks they know better than to read all of the documentation and therefore necessari

If you link a program with a compiler driver (clang/gcc) in a standard way (not -nostdlib), the following components are usually on the linker command line.

  • crt1.o (glibc/musl): -no-pie/-pie/-static-pie
    • crt1.o: -no-pie
    • Scrt1.o: -pie, -shared
    • rcrt1.o: -static-pie
    • gcrt1.o:
  • crti.o (glibc/musl)
  • crtbegin.o
  • crtbegin.o: -no-pie
@dcode
dcode / GitHub Flavored Asciidoc (GFA).adoc
Last active September 20, 2024 17:12
Demo of some useful tips for using Asciidoc on GitHub

GitHub Flavored Asciidoc (GFA)

@jeregrine
jeregrine / Howto.md
Created May 12, 2015 19:37
Setting up Redo and Poolboy for redis connections in Elixir

Then add

worker(Redis, []),

to your supervision tree

@maarek
maarek / server.ex
Last active August 29, 2015 14:20
Elixir Chat Server
defmodule Chat.Server do
use Application
# Create a Room structure that has a list of clients
defmodule Room do
defstruct users: []
end
defmodule User do
defstruct name: "", socket: Socket
@jcgregorio
jcgregorio / How_to_use.html
Last active July 17, 2023 14:44
HTML Templating using the HTML <template> element and exactly 100 lines of JS. A cleaned up version of this code is now available at https://github.com/jcgregorio/stamp/.
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<script src="templating.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<template id=t>
@udondan
udondan / include_vars_merged
Last active June 15, 2023 17:57
Ansible action plugin "include_vars_merged". Same as "include_vars" but merges hashes instead of overriding

Why?

Current version of Ansible (1.7.1) does not merge hashes in the include_vars task even if told so via hash_behaviour = merge in your ansible.cfg. ansible/ansible#9116

This action plugin will merge hashes no matter how you have configured your hash_behaviour.

How to setup:

Save include_vars_merged.py to library/plugins/action/include_vars_merged.py

Save include_vars_merged to library/custom/include_vars_merged

@gburd
gburd / async_nif.h
Last active October 3, 2023 05:12
Technique for running Erlang NIFs functions asynchronously, not on scheduler threads.
/*
* async_nif: An async thread-pool layer for Erlang's NIF API
*
* Copyright (c) 2012 Basho Technologies, Inc. All Rights Reserved.
* Author: Gregory Burd <greg@basho.com> <greg@burd.me>
*
* This file is provided to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active August 26, 2024 11:06 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@cwjohnston
cwjohnston / setrevision.rb
Created April 3, 2012 16:49
knife exec script for setting the value of a particular node attribute (i.e. core.revision or haystack.revision)
# knife-exec script to set git revision to be deployed for specified application
# Example usage: knife exec /path/to/this/script/setrevision haystack i-fb106a9f v69.10
require 'chef/knife'
require 'chef/shef/ext'
# - ARGV[2] expected to be the app name (e.g. haystack, core)
# - ARGV[3] expected to be the node name
# - ARGV[4] expected to be the revision id