Skip to content

Instantly share code, notes, and snippets.

View matthiasbeyer's full-sized avatar

Matthias Beyer matthiasbeyer

View GitHub Profile
@matthiasbeyer
matthiasbeyer / lib.rs
Created October 15, 2020 09:29
Stream of buffers to stream of lines
// should be all code...
use std::pin::Pin;
use std::result::Result as RResult;
use futures::Stream;
use futures::StreamExt;
use futures::task::Context;
use futures::task::Poll;
use anyhow::Error;
@matthiasbeyer
matthiasbeyer / git-diff-to.sh
Created April 17, 2021 09:33
diff a branch to a base branch
#!/usr/bin/env bash
help() {
cat <<EOS
$0 [-h | --help] [base] [head]
Diff current branch (or [head], if passed) to [base]
EOS
}
@matthiasbeyer
matthiasbeyer / mypackage.nix
Created November 9, 2021 20:00
Using a specific nixpkgs version to install a package
{ pkgs ? (import <nixpkgs> {}) }:
rec {
# import nixpkgs from a specific commit hash
oldNixpkgs = pkgs.fetchFromGitHub {
owner = "nixos";
repo = "nixpkgs";
# here goes the commit hash
rev = "c2268175651c4aa1da23c1b84ecebc0a0df56633";
@matthiasbeyer
matthiasbeyer / pre-commit
Last active May 1, 2022 08:07
Non-failing cargo fmt git hook for files patched in current staging
#!/usr/bin/env bash
Green='\e[0;32m' # Green
Red='\e[0;31m' # Red
Color_Off='\e[0m' # Text Reset
files=$(cargo fmt -- --check --files-with-diff)
staged=$(git diff --name-only --staged)
@matthiasbeyer
matthiasbeyer / lint.yaml
Created May 31, 2022 07:18
github action for linting commit messages with gitlint
name: lint commit messages
on:
pull_request:
jobs:
commit-lint:
runs-on: "ubuntu-latest"
steps: