Skip to content

Instantly share code, notes, and snippets.

@danbst
danbst / iphone.nix
Created September 8, 2018 20:05
iPhone pairing for NixOS
# First add this module to your /etc/nixos/configuration.nix
# ...
# imports = [ /path/to/iphone.nix ];
# iphone.enable = true;
# iphone.user = "yourusername";
# ...
# Then rebuild system. Attach iPhone via cable, open terminal and run command `iphone`
# It will fail, but there will occure a dialog on your iPhone to "trust this computer"
# Press OK there and run `iphone` again. If it succeeds it will open a freshly mounted folder
@gmaslowski
gmaslowski / cassandra-node2pod.yml
Last active October 18, 2023 05:24
k8s-cassandra-nodeLabel2pod
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cassandra-rackdc
data:
cassandra-rackdc.properties: |
dc= datacenter
rack= RACK
---
#!/usr/bin/env bash
# Installs NixOS on an OVH server, wiping the server.
#
# This is for a specific server configuration; adjust where needed.
# Originally written for an OVH STOR-1 server.
#
# Prerequisites:
# * Create a LUKS key file at /root/benacofs-luks-key
# e.g. by copying it up.
@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";
};
@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

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

: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,Б\\<,Ю>,№#
@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

@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"
)
@antifuchs
antifuchs / dock.nix
Last active April 30, 2024 08:12
A nix module that arranges the macOS dock the way you want it. Note: It won't allow you to manually re-arrange the items on it; the dock gets reset everytime you log in.
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.local.dock;
stdenv = pkgs.stdenv;
in
{
options = {
local.dock.enable = mkOption {
description = "Enable dock";