Skip to content

Instantly share code, notes, and snippets.

@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
@spinus
spinus / falcon.nix
Created June 15, 2022 10:47
crowdstrike falcon
{pkgs?import <nixpkgs> {}}:
with pkgs;
stdenv.mkDerivation {
name = "falcon-sensor";
version = "4.18.0-6402";
arch = "amd64";
src = ./falcon-sensor_6.34.0-13108_amd64.deb;
nativeBuildInputs = [ dpkg autoPatchelfHook zlib pkgs.libnl pkgs.openssl ];
@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

@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
@yannickjones
yannickjones / sre-interview-questions.txt
Created November 17, 2022 15:15
SRE Interview questions
- Intros + background overview
- API service in a k8s clusters
+ Single region HA from starting with a single pod deployment?
+ API talks to MongoDB outside of the cluster
+ Describe KPIs for this application?
+ Describe how you would make this service multi region in AWS at a high level?
- What are the three types of observability data?
- How would you troubleshoot a k8s pod stuck in a crashloopbackoff state?
- How can you expose a k8s application publicly using AWS and EKS?
- How can you provide a file to a pod in k8s without building it into your application image?
@rms1000watt
rms1000watt / golang-template-if-and.go
Last active July 13, 2023 20:10
Golang script for using templates with IF and AND
package main
import (
"fmt"
"os"
"text/template"
)
type Person struct {
Name string
@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";
};
@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
@miguelmota
miguelmota / ssm_parameter.go
Last active September 26, 2023 10:36
AWS SSM Go SDK parameter store example
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"
)
@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
---