Skip to content

Instantly share code, notes, and snippets.

View lukehinds's full-sized avatar
🏃‍♂️
Either running or coding.

Luke Hinds lukehinds

🏃‍♂️
Either running or coding.
View GitHub Profile
@masak
masak / explanation.md
Last active July 9, 2024 17:07
How is git commit sha1 formed

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <jnthn@jnthn.net>
Date:   Sun Apr 15 16:35:03 2012 +0200

When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.

@carlessanagustin
carlessanagustin / update-playbook.sh
Last active June 9, 2021 16:59
Quick Bash script for running Ansible Playbooks
#!/usr/bin/env bash
########################## REQUIREMENTS
# sudo apt-get install ansible unzip
########################## VARIBLES
PLAYBOOK_GZ="playbook.zip"
PLAYBOOK_FILE="update.yml"
INVENTORY_FILE="all"
EXTRA_ARGS="--list-tasks --list-hosts"
@JeffBelback
JeffBelback / docker-destroy-all.sh
Last active May 25, 2024 20:19
Destroy all Docker Containers and Images
#!/bin/bash
# Stop all containers
containers=`docker ps -a -q`
if [ -n "$containers" ] ; then
docker stop $containers
fi
# Delete all containers
containers=`docker ps -a -q`
if [ -n "$containers" ]; then
docker rm -f -v $containers
@jpf
jpf / signed-jwt-in-python.md
Last active February 17, 2024 15:07
JWTs signed with RS256 in Python: A demonstration of org-babel

Introduction

This is a guide to using pyjwt to sign and validate a JWT using RS256.

The trickiest part of doing this is knowing what the proper OpenSSL commands are to generate the RSA keypair. I demonstrate that below.

Generating RSA keys

@sdorra
sdorra / keys.go
Created April 17, 2016 19:31
Golang RSA Key Generation
/*
* Genarate rsa keys.
*/
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
yum install vim-enhanced zsh wget -y
wget https://gist.githubusercontent.com/lukehinds/a4cd9b82e65d06e4771beb7a5322a36e/raw/7e4cd3557bd852b349d8f1b276aa586aa102d5ec/.vimrc
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
git clone git://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/plugins/zsh-autosuggestions
@kebman
kebman / openssltutorial.md
Last active November 25, 2022 12:35
How To Encrypt a File – And Securely Send It – using OpenSSL

Here is a tutorial – or simulation, rather – on symmetric file encryption, and public key encryption to securely send your keys and files to a friend using OpenSSL with the Terminal. The tutorial is made for UX systems (e.g. OS X and Linux), and you may have to install OpenSSL if you don't have it (OS X should have it pre-installed).

Note: The use of the dollar sign ($) in front of the terminal lines is just a convention. Ignore it, and focus on what comes after it.

Simulation

@jradek
jradek / ssl_certificate_tutorial.md
Last active April 17, 2019 09:32
SSL certificate tutorial (Self Signed)

SSL Certificate tutorial

Tutorial

As certificate authority (CA)

  • Create self signed certificate ca.cert

    openssl req -newkey rsa:2048 -nodes -keyout ca.key -x509 -days 365 -out ca.cert
@dnoliver
dnoliver / enrollment.sh
Last active July 3, 2023 12:31
TPM 2.0 Device Identity Attestation Samples
#!/bin/bash
# Dependencies
# tpm2-tools-4.0.1-1.fc31.x86_64
# tpm2-tss-2.3.1-1.fc31.x86_64
# tpm2-tss-engine-master
set -euxo pipefail
export TPM2TOOLS_TCTI="device:/dev/tpmrm0"
@xirkus
xirkus / yubikey+gpupgp+ssh_howto.md
Last active May 8, 2024 08:34
Security Adventures 1. How to get yubikey+gpg+ssh+gitbhub working on MacOS

I've spent the day trying to get this setup working with GitHub and given the number of gotcha's I encountered, it seemed like a good idea to document how I finally got this working with as few hacks as possible. There's a lot of documentation out there (some of it old and misleading) and committing here for posterity will help me remember this when I inevitably need to do this again.

Rationale

Passwords are simply not enough these days. Regardless of the company, breaches (and the associated Personally Identifiable Information harvested) are a matter of not if, but when. There are a number of things you can do to protect yourself, but being on the tin-foil-hat side of paranoia, means there are a few Commandents that I adhere to (and recommend for other folks)[Insert link to Fight Club Rules for the Secure Internet].

That being said, if you use 2-factor authentication and have committed to using a hardware token such as the Yubikey, then you're already ahead of the curve. The problem is that wh