Skip to content

Instantly share code, notes, and snippets.

@petrkohut
petrkohut / SSH_MACOS_SECURE_ENCLAVES.md
Created November 24, 2025 22:24 — forked from arianvp/SSH_MACOS_SECURE_ENCLAVES.md
Native Secure Enclaved backed ssh keys on MacOS

Native Secure Enclave backed ssh keys on MacOS

It turns out that MacOS Tahoe can generate and use secure-enclave backed SSH keys! This replaces projects like https://github.com/maxgoedjen/secretive

There is a shared library /usr/lib/ssh-keychain.dylib that traditionally has been used to add smartcard support to ssh by implementing PKCS11Provider interface. However since recently it also implements SecurityKeyProivder which supports loading keys directly from the secure enclave! SecurityKeyProvider is what is normally used to talk to FIDO2 devices (e.g. libfido2 can be used to talk to your Yubikey). However you can now use it to talk to your Secure Enclave instead!

@petrkohut
petrkohut / check-ssl.sh
Created February 20, 2018 09:20
Check remote SSL cert based on domain name
curl --insecure -v https://google.com 2>&1 | awk 'BEGIN { cert=0 } /^\* SSL connection/ { cert=1 } /^\*/ { if (cert) print }'
@petrkohut
petrkohut / curl-with-times.sh
Created December 4, 2017 16:31
Curl with transfer time on output
curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" https://www.seznam.cz/media/img/logo_v2.png
@petrkohut
petrkohut / get_into_stopped_container.md
Created August 28, 2017 12:25
How to get into stopped container if we are not able to make it run again
@petrkohut
petrkohut / check.sh
Created August 18, 2017 14:46
Check if last commit contains changes in package.json
git log -n 1 --pretty=format:%H -- package.json
@petrkohut
petrkohut / kibana-queries.md
Last active July 24, 2017 12:32
Lucine queries

Lucine queries for search in Kibana

AND

field1: "something" AND field2: "something else"

OR

field1: "something" AND (field2: "something else" OR field2: "nothing")

NOT

Filter out all messages where field1 contains string "Petr"

image.json

{
  "builders": [
    {
      "type": "docker",
      "image": "ubuntu",
      "commit": true
    }
 ],
@petrkohut
petrkohut / search-empty-string.md
Created April 10, 2017 07:56
Elasticsearch query - how to search empy string

How to search empty string in Elasticsearch

{
  "query": {
    "filtered": {
      "filter": {
        "not": {
          "filter": {
            "range": {
 "yourFieldName": {}
@petrkohut
petrkohut / test_tcp_udp.md
Last active March 24, 2017 16:00
Test TCP/UDP which port is open

TCP

sudo telnet 10.10.0.195 9300

UDP

sudo nmap -p 9300 -sU -P0 10.10.0.195

Open ports

Keybase proof

I hereby claim:

  • I am petrkohut on github.
  • I am petrkohut (https://keybase.io/petrkohut) on keybase.
  • I have a public key whose fingerprint is 44CE B549 9C7C D49F 5AFC 0562 7661 C898 200A C505

To claim this, I am signing this object: