Skip to content

Instantly share code, notes, and snippets.

View sidcha's full-sized avatar
💡
Thinking...

Siddharth Chandrasekaran sidcha

💡
Thinking...
View GitHub Profile
@sidcha
sidcha / LUKS_and_TPM2_with_Fedora.md
Created February 26, 2025 13:56 — forked from jdoss/LUKS_and_TPM2_with_Fedora.md
Decrypt LUKS volumes with a TPM on Fedora Linux

Decrypt LUKS volumes with a TPM on Fedora Linux

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
@sidcha
sidcha / printable-scanned-ids.sh
Last active December 30, 2024 17:53
Apple's Notes app can scan ID cards (front and back) very well; it produces a PDF file out of the scanned images. This PDF file is not suitable for printing on A4 size paper as the image spans the entire width. The following can be used to put both the front and back images in one A4-sized page which can be printed
# Requirements:
# - imagemagick
# - ghostscript
convert -density 300 notes_app_scanned_doc.pdf -gravity center -resize 1240x1754\> -background white -append -background white -splice 0x600 temp_combined.jpg
convert temp_combined.jpg -gravity center -extent 2480x3508 output.pdf
@sidcha
sidcha / ..git-pr.md
Created April 7, 2020 12:13 — forked from gnarf/..git-pr.md
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@sidcha
sidcha / split-patch.pl
Created April 21, 2019 09:38
Splits or dissects large patch file into smaller per-file-change patches. Comes in handy when patches don't apply anymore.
#!/bin/perl
while (<>) {
if(/^diff --git a\/(\S+)/) {
close $f if $f;
$s=$1;
$s =~ s:(/|\.):_:g;
$n=sprintf("%03d_%s.patch", ++$i, $s);
open $f, ">", $n;
print $f $_;
@sidcha
sidcha / read_line.c
Last active April 21, 2019 09:51
A single file readline implementation. Written in a classroom for educational purpose. This code will not be supported.
/******************************************************************************
Copyright (c) 2017 Siddharth Chandrasekaran
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: