Skip to content

Instantly share code, notes, and snippets.

View rochacon's full-sized avatar

Rodrigo Chacon rochacon

  • Remote
  • 10:00 (UTC -03:00)
View GitHub Profile
@jdoss
jdoss / LUKS_and_TPM2_with_Fedora.md
Last active March 2, 2024 10:31
Decrypt LUKS volumes with a TPM on Fedora 35+

Decrypt LUKS volumes with a TPM on Fedora 35+

This guide allows you to use the TPM on your computer to decrypt your LUKS encrypted volumes. If you are worried about a cold boot attack on your hardware please DO NOT use this guide with your root volume!

Preflight Checks

Verify that you have a TPM in your computer:

# systemd-cryptenroll --tpm2-device=list
PATH DEVICE DRIVER
@elisboa
elisboa / sortfiles-exif.sh
Last active August 22, 2022 16:59
A simple script to sort photo files based on their exif information
#!/usr/bin/env bash
# ---
#!/bin/bash -x
echo -e "### WELCOME TO $0\n"
if [[ -z ${DEST_DIR} ]]
then
TIMESTAMP=$(date +%s)
echo -e "Setting destination dir as ${TIMESTAMP}"
# based on https://github.com/junegunn/fzf/wiki/Examples#autojump
function _fzf_autojump() {
fzf --height 40% --reverse --inline-info
}
function _fzf_cleanup() {
awk '$1 ~ /[0-9]:/ && $2 ~ /^\// { for (i=2; i<=NF; i++) { print $(i) } }'
}
function gclone() {
local organization
local repositories
organization="$1"
repositories="$(gh repo list -L 1000 "$organization" | fzf --multi --cycle | awk '{print $1}')"
for repository in $repositories; do
echo "Cloning $repository"
gh repo clone "$repository"
done
}
@jaysonsantos
jaysonsantos / vpn-nat.ps1
Last active March 12, 2021 14:52
Use openvpn inside WSL2 and be able to route traffic from windows through linux
# On linux side you need iptables
# On windows side you need sudo which can be installed with scoop
$CidrBlocks = "10.0.0.0/16", "10.1.0.0/16", "10.70.0.0/16", "10.3.0.0/16"
$WslIP = "$(wsl -- ip addr show dev eth0 | Select-String -Pattern 'inet ')"
$WslIP = $WslIP.Split(' ').Where{ $_.Length }[1].Split('/')[0]
function BuildIptablesRoute {
param (
[Parameter(Mandatory = $true)]
@yanniszark
yanniszark / split_yaml.go
Created April 15, 2020 11:54
Golang: Multiple YAML Documents / Split YAML
import goyaml "github.com/go-yaml/yaml"
func SplitYAML(resources []byte) ([][]byte, error) {
dec := goyaml.NewDecoder(bytes.NewReader(resources))
var res [][]byte
for {
var value interface{}
err := dec.Decode(&value)
@bernardomig
bernardomig / README.md
Last active October 29, 2023 15:32
Setup podman and nvidia-container-runtime

How to setup nvidia-container-runtime and podman/runc

Podman is such a cool project! However, there is no easy way to setup the nvidia-container-runtime and podman so that we can run unprivileged container in a gpu host. This is specially interesting in environments with multiple people accessing the same host (strong isolation between containers!!!).

Steps to setup the whole system

  1. Install podman and friends (buildah and skopeo)

Ubuntu: add-apt-repository -y ppa:projectatomic/ppa &amp;&amp; apt install podman buildah skopeo

@akhenakh
akhenakh / app.yaml
Last active March 4, 2023 19:22
Example of graceful shutdown with grpc healthserver * httpserver
readinessProbe:
exec:
command: ["/root/grpc_health_probe", "-addr=:6666"]
initialDelaySeconds: 1
livenessProbe:
exec:
command: ["/root/grpc_health_probe", "-addr=:6666"]
initialDelaySeconds: 2
imagePullPolicy: IfNotPresent
@kannangce
kannangce / FeignSSLUtils.java
Last active April 3, 2024 09:11
Feign client for 1 or 2-way TLS with self signed certificates when javax.net.ssl.keyStore / javax.net.ssl.trustStore cannot be overridden.
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.AccessController;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
@roadrunner2
roadrunner2 / 0 Linux-On-MBP-Late-2016.md
Last active May 13, 2024 12:14
Linux on MacBook Pro Late 2016 and Mid 2017 (with Touchbar)

Introduction

This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 27, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.14.x (after latest update).

The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on https://github.com/Dunedan/mbp-2016-linux . And for Ubuntu users there are a couple tutorials (here and here) focused on that distro and the MacBook.

Note: For those who have followed these instructions ealier, and in particular for those who have had problems with the custom DSDT, modifying the DSDT is not necessary anymore - se