Skip to content

Instantly share code, notes, and snippets.

View ZeroDeth's full-sized avatar
🏠
Working from home

Sherif Abdalla ZeroDeth

🏠
Working from home
View GitHub Profile
@ZeroDeth
ZeroDeth / pre-commit
Created February 22, 2023 14:51 — forked from ilyakatz/pre-commit
helpful precommit hooks
#!/bin/bash -l
# A git hook script to find and fix trailing whitespace
# in your commits. Bypass it with the --no-verify option
# to git-commit
#
.git/hooks/pre-commit-master-no-no
if [[ $? == 1 ]]
then

Installing on Linode

I copied the bulk of this guide from Andrew Miller's NixOS-On-Linode.md instructions. It's a very well-written guide, but I felt we could make things a bit more simple than he left them in his original guide.

This tutorial is written for people who want to run NixOS on a Linode instance. The installation is pretty straightforward, but it involves some bootstrapping using Linode's tools.

In this tutorial, we will show you how to set up NixOS on Linode by setting up disks (including the installation live CD) using the rescue OS, and use the minimal live CD to install NixOS onto your disk.

Create a Linode

@ZeroDeth
ZeroDeth / Readme.md
Created November 19, 2022 18:38 — forked from rms1000watt/Readme.md
Github Actions --> AWS OIDC in Terraform
Byobu is a suite of enhancements to tmux, as a command line
tool providing live system status, dynamic window management,
and some convenient keybindings:
F1 * Used by X11 *
Shift-F1 Display this help
F2 Create a new window
Shift-F2 Create a horizontal split
Ctrl-F2 Create a vertical split
Ctrl-Shift-F2 Create a new session
@ZeroDeth
ZeroDeth / terraform-presigned-url.tf
Created July 8, 2022 13:36 — forked from kharandziuk/terraform-presigned-url.tf
A hack to generate a presigned url in terraform
variable "bucket_name" {
default = "max-bucket-for-testing"
}
provider "aws" {
region = var.aws_region
profile = var.aws_profile
}
resource "aws_s3_bucket" "artifacts" {
@ZeroDeth
ZeroDeth / GPG and git on macOS.md
Created April 24, 2022 10:29 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@ZeroDeth
ZeroDeth / gpg_git_signing.md
Created April 24, 2022 10:23 — forked from alopresto/gpg_git_signing.md
Steps to enable GPG signing of git commits.

If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:

  1. Generate and add your key to GitHub
  2. $ git config --global commit.gpgsign true ([OPTIONAL] every commit will now be signed)
  3. $ git config --global user.signingkey ABCDEF01 (where ABCDEF01 is the fingerprint of the key to use)
  4. $ git config --global alias.logs "log --show-signature" (now available as $ git logs)
  5. $ git config --global alias.cis "commit -S" (optional if global signing is false)
  6. $ echo "Some content" >> example.txt
  7. $ git add example.txt
  8. $ git cis -m "This commit is signed by a GPG key." (regular commit will work if global signing is enabled)
@ZeroDeth
ZeroDeth / example.nix
Created February 2, 2022 15:00 — forked from damianbaar/example.nix
nix expression that provides a way to copy your zsh configuration files
{ pkgs ? import <nixpkgs> {}
, zdotdir ? import (builtins.fetchurl {
url = "https://gist.githubusercontent.com/damianbaar/57aff242d06c75444dbd36bf5400060e/raw/83d074d45c81a18402146cadc595a20b91bb1985/zdotdir.nix";
}) { inherit pkgs; }
}:
pkgs.stdenv.mkDerivation {
name = "withZshEnv";
shellHook= zdotdir {
zshenv = builtins.path { path = ./zdotdir/zshenv; };
zshrc = builtins.path { path = ./zdotdir/zshrc; };
@ZeroDeth
ZeroDeth / nix_example_upgrade_terraform.txt
Created January 29, 2022 22:19 — forked from pschyska/nix_example_upgrade_terraform.txt
Example: Upgrading a nixpkgs package with a new version - terraform
# acquire nix-prefetch
$ cat > default.nix <<-"EOF"
with import <nixpkgs> { };
pkgs.mkShell rec { nativeBuildInputs = [ pkgs.nix-prefetch ]; }
EOF
$ nix-shell
# N.B.: in nix-shell my PS1 changes to (impure) *
# override terraform derivation with new source, but without sha256 and vendorSha256
(impure) * cat > terraform.nix <<-"EOF"
@ZeroDeth
ZeroDeth / flake-direnv.md
Created January 25, 2022 18:13 — forked from inscapist/flake-direnv.md
Nix Flakes and Direnv on Mac OSX (Catalina)

Development environment with Nix Flakes and Direnv

This document is targeted at those who seek to build reproducible dev environment across machines, OS, and time.

It maybe easier for remote teams to work together and not spending hours each person setting up asdf/pyenv/rbenv, LSP servers, linters, runtime/libs. Nix is probably the closest thing to Docker in terms of development environment.

Flake is used here because it provides hermetic build, with absolutely no reliance on system environment (be it Arch/Catalina/Mojave). Also it freezes dependencies in flake.lock so builds are reproducible.

This gist provides the setup to develop Java/Clojure/Python applications on Nix. But it can be easily adapted to ruby, nodejs, haskell.