Skip to content

Instantly share code, notes, and snippets.

Avatar
🐧
Overwintering in Kerguelen Islands

Jean-Philippe Cugnet ejpcmac

🐧
Overwintering in Kerguelen Islands
View GitHub Profile
@ejpcmac
ejpcmac / zfs-clean-snapshot
Last active Jun 12, 2019
Clean old ZFS auto-snapshots on backup destinations
View zfs-clean-snapshot
#!/bin/sh
list_snapshots() {
zfs list -t snapshot -o name $1 | grep $2 | tac | tail -n +$(($3 + 1)) | sed 's/.*@//' | sed -z 's/\n/,/g'
}
if [ $# -ne 1 ]; then
echo "usage: $0 <dataset>"
exit 1
fi
@ejpcmac
ejpcmac / Procedures.md
Last active May 28, 2020
Procedures for getting back on a project and making a new release
View Procedures.md

Procedures

Getting back on a project

  • Checkout the develop branch (if using git-flow)
  • Bump the version to the next -dev one
  • Create an [Unreleased] section in the CHANGELOG.md
  • Ensure the copyrights are up to date
  • Update the .envrc, shell.nix, project definition and all dotfiles
@ejpcmac
ejpcmac / .envrc
Created Sep 28, 2018
.envrc for Phoenix projects using Nix and PostgreSQL
View .envrc
####################################
# Environment setup for Nix shells #
####################################
# From https://github.com/direnv/direnv/wiki/Nix#persistent-cached-shell
#
# Usage: use_nix [...]
#
# Load environment variables from `nix-shell`.
# If you have a `default.nix` or `shell.nix` one of these will be used and
@ejpcmac
ejpcmac / setup
Created Sep 28, 2018
Setup script for Phoenix projects using Nix and PostgreSQL
View setup
#!/bin/sh
echo
if [ ! -d "deps" ] || [ ! "$(ls -A deps)" ]; then
printf "\e[32m=> Fetching dependencies and building the application...\e[0m\n\n"
echo "+ mix do deps.get, compile --verbose"
mix do deps.get, compile --verbose
echo
fi
@ejpcmac
ejpcmac / shell.nix
Created Sep 28, 2018
Shell for Phoenix projects with node.js and PostgreSQL
View shell.nix
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
inherit (lib) optional optionals;
elixir = beam.packages.erlangR21.elixir_1_7;
nodejs = nodejs-10_x;
postgresql = postgresql100;
@ejpcmac
ejpcmac / shell.nix
Last active Sep 26, 2018
Shell for Nerves projects
View shell.nix
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
inherit (lib) optional optionals;
elixir = beam.packages.erlangR21.elixir_1_7;
in
mkShell {
@ejpcmac
ejpcmac / shell.nix
Last active Sep 26, 2018
Shell for standard Elixir projects with file_system and ExUnit Notifier
View shell.nix
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
inherit (lib) optional optionals;
elixir = beam.packages.erlangR21.elixir_1_7;
in
mkShell {
@ejpcmac
ejpcmac / shell.nix
Created Sep 26, 2018
Bare minimum shell for Elixir projects
View shell.nix
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
# I like to define variables for derivations that have
# a specific version and are subject to change over time.
elixir = beam.packages.erlangR21.elixir_1_7;
in
@ejpcmac
ejpcmac / .envrc
Created Sep 18, 2018
.envrc for persistent cached Nix shells
View .envrc
####################################
# Environment setup for Nix shells #
####################################
# From https://github.com/direnv/direnv/wiki/Nix#persistent-cached-shell
#
# Usage: use_nix [...]
#
# Load environment variables from `nix-shell`.
# If you have a `default.nix` or `shell.nix` one of these will be used and
@ejpcmac
ejpcmac / shell.nix
Last active Mar 27, 2020
Example shell.nix for Nerves projects, setting both Erlang and Elixir versions
View shell.nix
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
inherit (lib) optional optionals;
erlangDrv = { mkDerivation }:
mkDerivation rec {
version = "21.0";
You can’t perform that action at this time.