Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Jean-Philippe Cugnet ejpcmac

🎯
Focusing
View GitHub Profile
@ejpcmac
ejpcmac / .gitsetup
Created Oct 7, 2022
Script to configure git-flow with custom values
View .gitsetup
#!/bin/sh
set -e
set -x
# Setup git-flow
git flow init -d
git config gitflow.prefix.versiontag "v"
git config gitflow.feature.finish.no-ff true
git config gitflow.release.finish.sign true
@ejpcmac
ejpcmac / build.rs
Last active Sep 29, 2022
Define a VERSION_WITH_GIT environment variable for Rust projects.
View build.rs
use std::{io, process::Command};
fn main() {
define_version_with_git();
}
/// Defines a variable containing the version with the Git revision.
///
/// `VERSION_WITH_GIT` contains at least the cargo version, even when Git is not
/// available. When Git is available, the current Git revision and dirty state
@ejpcmac
ejpcmac / zfs-clean-snapshot
Last active Jul 30, 2022
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 Jul 18, 2021
Procedures for getting back on a project and making a new release
View Procedures.md

Procedures

Getting back on a project

  • Check that the Git configuration is up to date (in Magit)
  • Checkout the develop branch (if using git-flow)
  • Bump the version to the next -dev one and reate an [Unreleased] section in the CHANGELOG.md
  • Rename the master branch to main
  • Update the CONTRIBUTING.md and README.md if necessary
@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