Skip to content

Instantly share code, notes, and snippets.

View arogozhnikov's full-sized avatar

Alex Rogozhnikov arogozhnikov

View GitHub Profile
@arianvp
arianvp / SSH_MACOS_SECURE_ENCLAVES.md
Last active April 28, 2026 09:51
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!

@arogozhnikov
arogozhnikov / edgedb_feedback.markdown
Last active August 23, 2023 19:08
Edgedb feedback, comparison of edgedb vs sqlmodel/sqlalchemy

Notes on edgedb

I’ve made a test evaluation of edgedb for the purposes of a small company.

My order of priorities (starting from most important):

  1. correctness of results (data and code)
  2. developer convenience
  3. minimal maintenance
  4. efficiency/scalability
@geerlingguy
geerlingguy / arducam-hawk-eye-setup.sh
Last active March 7, 2025 15:15
ArduCam Hawk-Eye 64MP camera setup
# Download the pivariety driver install script and make it executable
wget -O install_pivariety_pkgs.sh https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/install_pivariety_pkgs.sh
chmod +x install_pivariety_pkgs.sh
# Install libcamera dev and apps
./install_pivariety_pkgs.sh -p libcamera_dev
./install_pivariety_pkgs.sh -p libcamera_apps
# Install the Hawk-Eye kernel driver
./install_pivariety_pkgs.sh -p 64mp_pi_hawk_eye_kernel_driver
@going-digital
going-digital / math.wasm
Last active May 9, 2024 21:07
WebAssembly native sin, log and exp functions optimised for code size.
;; Native implementations of sin, log and exp functions.
;; sintau: 41 bytes code, 34 bytes shared code, 24 bytes data
;; exp2: 25 bytes code, 34 bytes shared code, 20 bytes data
;; log2: 37 bytes code, 34 bytes shared code, 24 bytes data
;; Total 137 bytes code, 68 bytes data
;; Wasm-opt -Oz tries to optimise out $half by converting to f32.consts, but that actually takes up more space, not less.
;; Polynomial coefficients calculated by accompanying python script.
;; call $evalpoly parameters will need to be manually changed for different length polynomials.
@jitran
jitran / app.py
Last active September 18, 2022 00:09
AWS CDK Python - Overriding the resource logical IDs
#!/usr/bin/env python3
from aws_cdk import core
from my_python_sample.my_python_sample_stack import MyPythonSampleStack
app = core.App()
MyPythonSampleStack(app, 'my-python-sample', env={'region': 'ap-southeast-2'})
@yang-song
yang-song / grad_lib.py
Last active August 8, 2022 19:38
L operator and R operator in Tensorflow
import tensorflow as tf
def gradients(f, x, grad_ys=None):
'''
An easier way of computing gradients in tensorflow. The difference from tf.gradients is
* If f is not connected with x in the graph, it will output 0s instead of Nones. This will be more meaningful
for computing higher-order gradients.
* The output will have the same shape and type as x. If x is a list, it will be a list. If x is a Tensor, it

An error

I was using TEQC to do quality control of my WES bam files aligned by bwa-mem. My data are paired end, so a function reads2pairs is called to make the paired-end reads to be a single fragment. I then get this error:

> readpairs <- reads2pairs(reads)
Error in reads2pairs(reads) : read pair IDs do not seem to be unique

I asked in the bioconductor support site and went to the source code of that function.

@marten-cz
marten-cz / docker-run-user.sh
Created April 8, 2017 15:57
Run docker with current user
# Run command with the same user ID as current user
# -v $(pwd):/tmp/mount - mount current directory to /tmp/mount/
# --env HOME="/tmp/" - some commands may need to be able to write to your home, se it to temporary folder
docker run -ti --rm -v $(pwd):/tmp/mount —user=$(id -u) --env HOME="/tmp/" debian:jessie
# Mount current users and group and be able to use them
# mount /etc/group and /etc/passwd read only
# set user from $USER
docker run -ti --rm -v $(pwd):/tmp/mount -w /tmp/hx -v /etc/group:/etc/group:ro -v /etc/passwd:/etc/passwd:ro —user=$USER debian:jessie
@arogozhnikov
arogozhnikov / SpeedBenchmarks.ipynb
Last active August 29, 2015 14:24
Speed benchmark of number crunchers in python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mstaflex
mstaflex / rc.local
Created April 30, 2015 14:25
Setting up simple execution environment with tmux and rc.local
# executing a script for user 'pi' with std. shell
su -c "./home/pi/run_robbi_demo.sh" -s /bin/sh pi