Skip to content

Instantly share code, notes, and snippets.

@AverageMarcus
AverageMarcus / Dockerfile
Created September 2, 2021 08:49
Example multi-arch Dockerfile for Go projects
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.16 as builder
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app/
ADD . .
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" -o yourapplication main.go

Decrypt LUKS2-encrypted root partitions with TPM2

This guide is written for Arch Linux.

Requirements

  • systemd version 248 or newer
  • Use mkinitcpio for initramfs generation

Preparation

@mikeboiko
mikeboiko / git-credential-rbw
Last active March 31, 2024 13:55
Use bitwarden rbw as git-credential helper
#!/usr/bin/env bash
# rbw git-credential helper
# Based on https://github.com/lastpass/lastpass-cli/blob/master/contrib/examples/git-credential-lastpass
# A credential helper for git to retrieve usernames and passwords from rbw.
# For general usage, see https://git-scm.com/docs/gitcredentials.
# Here's a quick version:
# 1. Put this somewhere in your path.
# 2. git config --global credential.helper rbw
@ruandre
ruandre / nix-on-wsl-debian-ubuntu.md
Last active August 28, 2023 20:41
Nix on WSL Debian/Ubuntu

Nix on WSL Debian/Ubuntu

Prep

Install these if not already available:

sudo apt install curl xz-utils
@galamdring
galamdring / retrieveSSMParameters.go
Created May 20, 2020 16:20
Retrieve SSM Parameter Store values in Golang
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ssm"
"strings"
)
@jtojnar
jtojnar / gimp-nix.md
Last active April 18, 2023 04:38
How to use Nix to build fresh GIMP

Nix is a package manager that you can install in parallel with your system package manager on Linux or MacOS. It allows you to effortlesly build any of the thousands of packages defined in the nixpkgs repository or write your own package expressions. Packages in the nixpkgs repository get periodically built by our CI server so the GIMP dependencies will be obtained from binary cache saving you time.

To obtain Nix, you can simply run an installation script, or use your package manager if it is packaged in your distro repositories. Notably, there is a package in Arch’s AUR and Debian Unstable.

The pull request containing changes for the latest changes for GIMP master is NixOS/nixpkgs#67576. I usually update the branch several times a month to point to t

:set langmap=йq,цw,уe,кr,еt,нy,гu,шi,щo,зp,х[,ї],фa,іs,вd,аf,пg,рh,оj,лk,дl,ж\\;,є',ґ\\,яz,чx,сc,мv,иb,тn,ьm,ю.,./,ЙQ,ЦW,УE,КR,ЕT,НY,НY,ГU,ШI,ЩO,ЗP,Х{,Ї},ФA,ІS,ВD,АF,ПG,РH,ОJ,ЛK,ДL,Ж\\:,Є\\",Ґ<bar>,ЯZ,ЧX,СC,МV,ИB,ТN,ЬM,Б\\<,Ю>,№#

With GitHub Actions, a workflow can publish artifacts, typically logs or binaries. As of early 2020, the life time of an artifact is hard-coded to 90 days (this may change in the future). After 90 days, an artifact is automatically deleted. But, in the meantime, artifacts for a repository may accumulate and generate mega-bytes or even giga-bytes of data files.

It is unclear if there is a size limit for the total accumulated size of artifacts for a public repository. But GitHub cannot reasonably let multi-giga-bytes of artifacts data accumulate without doing anything. So, if your workflows regularly produce large artifacts (such as "nightly build" procedures for instance), it is wise to cleanup and delete older artifacts without waiting for the 90 days limit.

Using the Web page for the "Actions" of a repository, it is possible to browse old workflow runs and manually delete artifacts. But the procedure is slow and tedious. It is fine to delete one selected artifact. It is not for a regular cleanup. We need

@monkut
monkut / update_awslambda_envars.bash
Created January 11, 2020 05:11
update aws lambda environment variables via awscli and jq
# the `update-function-configuration` overwrites the existing set envars.
# In order to *ADD* variables we need to read the existing envars and add to that.
# This command uses `jq` to read and transform the json result to an envar then update the lambda configuration
# create the updated envar set
export YOUR_FUNCTION_NAME={populate this}
export UPDATED_ENVIRONMNET_VARIABLES=$(aws lambda get-function-configuration --function-name ${YOUR_FUNCTION_NAME} | \
jq --compact-output ".Environment + {\"Variables\": (.Environment.Variables + {\"NEW_ENVAR_NAME\": \"NEW_ENVAR_VALUE\"})}")
# check
@ravloony
ravloony / falcon-default.nix
Last active July 21, 2023 14:12
Falcon package
{ stdenv, dpkg, fetchurl, openssl, libnl, buildFHSUserEnv,... }:
stdenv.mkDerivation {
name = "falcon-sensor";
version = "4.18.0-6402";
arch = "amd64";
src = fetchurl {
url = "https://storage.googleapis.com/company-tools/falcon-sensor/falcon-sensor_4.18.0-6402_amd64.deb";
sha512 = "dc41cfe0232124480abdcf456df9a3bd6cab62716bc5beea089fbf99ac2e29bf1e1a44676591a71eeb35afe7f25e495b53ede007cfc15dcbf47df7ec0a016098";
};