Skip to content

Instantly share code, notes, and snippets.

@Patazerty
Patazerty / hsmghpg.rst
Created July 3, 2023 09:16
Nitrokey HSM 2 GPG setup

Nitrokey HSM GPG setup

I was investigating the use of Hardware Security Modules (HSMs) to better secure some stuff at work. Our choice was a Nitrokey HSM 2 for its convenient price, features and open approach, including hardware. Unfortunately Nitrokeys's documentation is sparse at best and there is not much available documentation online to guide new users to get HSMs to work with GnuPG (GPG): it's even the opposite with some forum posts indicating that the Nitrokey HSM 2 is not compatible with GPG.

From what seems to be the current state of things, GPG works out of the box with OpenPGP cards (which are

@ohanetz
ohanetz / Dockerfile-jenkins
Last active October 1, 2022 09:03
Utilize Jenkins in an auto-scaling Kubernetes deployment on Amazon EKS
FROM jenkins/jenkins:2.204.5
RUN /usr/local/bin/install-plugins.sh ssh-slaves
RUN /usr/local/bin/install-plugins.sh kubernetes
USER root
RUN apt-get update && apt-get install -y maven
USER jenkins
@dwallraff
dwallraff / quick_ca.md
Last active October 1, 2020 01:20
Quick and simple 'CA' signed cert

Quick and simple 'CA' signed cert (and learn some useful openssl commands)

This will NOT set up a 'proper' CA.
This will NOT be a trusted CA.
But it will give you a cert to use as your 'trusted CA' if needed.


Step 1

First, we need to create a new cert and key. This will be your new CA cert, so change the -subj values to something more appropriate.

@HorlogeSkynet
HorlogeSkynet / certificate_authorities
Last active November 8, 2019 18:26
_Minimal_ set of required Certificate Authorities to browse (a part of) the WWW on Mozilla Firefox
# _Minimal_ set of required Certificate Authorities to browse (a part of) WWW on Mozilla Firefox.
# This is based on the incredible work of [@aeris](https://imirhil.fr/).
# The set has been sorted by certificate nickname.
Certificate Nickname Trust Attributes
SSL,S/MIME,JAR/XPI
Amazon Root CA 1 C,,
Baltimore CyberTrust Root C,,
COMODO ECC Certification Authority C,,
:- discontiguous(not/1).
politician(X) :- mp(X).
politician(X) :- minister(X).
minister(X) :- prime_minister(X).
prime_minister(sri).
prime_minister(surat).
@shirriff
shirriff / mathcrack.py
Last active February 17, 2019 17:42
Rapidly crack Xerox Alto disk passwords using a mathematical formula that reverses the password hash
# Crack Xerox Alto disk passwords using math.
import sys
def findPasswd(passvec):
# a and b are the salt values
a = (passvec[1] << 16) + passvec[2]
b = (passvec[3] << 16) + passvec[4]
if a == 0 or b == 0:
print 'No password'
@Pulimet
Pulimet / AdbCommands
Last active May 5, 2024 13:39
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@tenkabuto
tenkabuto / Related Clubs.sql
Created June 8, 2017 21:40
Getting Related Clubs with Data Science Club (`125525`) for Test
@simonw
simonw / recover_source_code.md
Last active January 16, 2024 08:13
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
#!/usr/bin/env python
from zeep import Client
from zeep.plugins import HistoryPlugin
import re
from lxml.etree import Element
from lxml import etree
class Project(object):