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 / op-add-identities
Created January 4, 2022 11:20 — forked from eritbh/op-add-identities
1password SSH identity management helpers
#!/bin/bash
echo "Signing into 1password..."
eval $(op signin $@)
items=($(op list items | jq '.[] | select(.templateUuid == "110") | .uuid' --raw-output))
for uuid in "${items[@]}"; do
item_data="$(op get item "$uuid")"
private_key="$(echo "$item_data" | jq '.details.sections[0].fields[] | select(.t == "ssh private key") | .v' --raw-output)"
item_title="$(echo "$item_data" | jq '.overview.title' --raw-output)"
@ZeroDeth
ZeroDeth / my-nixos-installation.md
Created December 31, 2021 18:21
NixOS installation guide, tailored to my needs

Preface

This manual describes how to install, use and extend NixOS, a Linux distribution based on the purely functional package management system Nix, that is composed using modules and packages defined in the Nixpkgs project.

Installation

This section describes how to obtain, install, and configure NixOS for first-time use.

Obtaining NixOS

NixOS ISO images can be downloaded from the NixOS download page. There are a number of installation options. In this manual we will assume that the chosen option is Minimal ISO image (64bit). You can burn it on a USB stick with:

# Instructions for fresh install
$ sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume --daemon
# reboot
$ source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
$ echo 'export NIX_PATH=darwin-config=$HOME/.nixpkgs/darwin-configuration.nix:$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH' | tee -a ~/.zshrc
$ echo 'source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh' | tee -a ~/.zshrc
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
$ nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
$ nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
@ZeroDeth
ZeroDeth / Makefile_include_exclude
Created September 8, 2020 17:01 — forked from davidlu1001/terraform_include_exclude
Makefile for Terraform to support include/exclude
PLAN_OPTIONS ?=
APPLY_OPTIONS ?=
EXCLUDE ?=
INCLUDE ?=
define PLAN_OPTIONS_EXCLUDE
$(shell terraform show current.plan | perl -pe 's//\n/ if $$. == 1' | perl -pe 's/\x1b\[[0-9;]*[mG]//g' | perl -ne 'if ($$p) { print unless /^$$/; $$p = 0 } $$p++ if /^$$/'| awk '{print $$2}' | grep -E -v '$(1)' | sed -e 's/^/-target="/g' -e 's/$$/"/g' | awk BEGIN{RS=EOF}'{gsub(/\n/," ");print}')
endef
define PLAN_OPTIONS_INCLUDE
#!/bin/bash
LOGFILE=/tmp/backup-gitlab-to-s3.log
GITLAB_BACKUP_FOLDER=/var/opt/gitlab/backups
S3_FILE_PREFIX=gitlab
S3_BUCKET_PATH=bucket-name-goes-here/folder-here
SLACK_USERNAME="Backup Gitlab Daily - `hostname`"
SLACK_CHANNEL="#od-infra-monitoring"
SLACK_ICON="https://s3.amazonaws.com/kudelabs-archives/harddrive256.png"
@ZeroDeth
ZeroDeth / Makefile
Created June 27, 2020 12:21 — forked from jonschlinkert/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@ZeroDeth
ZeroDeth / 00-defaults.tf
Created February 21, 2020 11:08 — forked from QuingKhaos/00-defaults.tf
Terraform initialization of AWS organizational root account, prepared for multiple accounts
variable "aws_default_region" {
default = "eu-west-1"
}
variable "administrator_default_arn" {
default = "arn:aws:iam::aws:policy/AdministratorAccess"
}
variable "developer_default_arn" {
default = "arn:aws:iam::aws:policy/PowerUserAccess"
#!/bin/sh
# Useful script for setting up my mac
### Some useful links ###
# Mac Setup (https://sourabhbajaj.com/mac-setup)
# Install Python 3 (https://docs.python-guide.org/starting/install3/osx)
# Cloud Foundry tools (https://github.com/cloudfoundry/homebrew-tap)
# Other Useful CLI tools (https://stevenloria.com/python-clis)
# zsh Magic (https://rick.cogley.info/post/use-homebrew-zsh-instead-of-the-osx-default)
# https://medium.com/@caulfieldOwen/youre-missing-out-on-a-better-mac-terminal-experience-d73647abf6d7
@ZeroDeth
ZeroDeth / ChocolateyInstall.txt
Created September 30, 2019 10:59 — forked from TomGaylor/ChocolateyInstall.txt
Chocolatey and Boxstarter system build script
#Launch the following at a cmd prompt to install Chocolatey - https://chocolatey.org/
###Launch cmd prompt as admin and run the following to set the proxy (inside Intel) and install Chocolatey####
setx http_proxy http://proxy-chain.intel.com:911 /M
setx https_proxy http://proxy-chain.intel.com:911 /M
####Write-Host "Installing Chocolatey"######