Skip to content

Instantly share code, notes, and snippets.

// Silly little XCode Playground for experimenting with the Secure Enclave programming.
// See more at https://developer.apple.com/videos/play/wwdc2019/709
// and also sample code at https://developer.apple.com/documentation/cryptokit/performing_common_cryptographic_operations
import UIKit
import CryptoKit
import LocalAuthentication
// Get access to secure enclave
#!/usr/bin/env bash
set -eu -o pipefail
###########################################################################
# zombie_branches.sh: Prune dead branches that don't exist in the upstream
#
# Author: @a10y
# Date: 22 June 2023
###########################################################################
import sys
import json
def parse_diarization(inf):
with open(inf, "r") as f:
return json.load(f)
def parse_speech(inf):
with open(inf, "r") as f:
return json.load(f)
"""
Translate a given input text file with a sequence of nucleic acid (A/C/G/T) DNA base
pairs into amino acid 1-letter codes.
Authori: @a10y
"""
AMINOS_TABLE = {
'ATA':'I', 'ATC':'I', 'ATT':'I', 'ATG':'M',
'ACA':'T', 'ACC':'T', 'ACG':'T', 'ACT':'T',
@a10y
a10y / coordinator.ts
Created August 16, 2022 02:41
Deno webworker example
import { serve } from "https://deno.land/std@0.140.0/http/server.ts";
serve(async (request) => {
const worker = new Worker(new URL("./worker.ts", import.meta.url).href, {
type: "module",
name: "worker-" + (100 * Math.random()).toFixed(),
});
const data = await request.json();
//
// rtsp_streamer.m
// dccameras
//
// Created by Andrew Duffy on 1/15/22.
//
#import <Foundation/Foundation.h>
#import <ffmpegkit/FFmpegKit.h>
#import <libavcodec/avcodec.h>
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#include "rtsp_streamer.h"
"""
Detect vertical edges using a convolution filter encoded via PyTorch.
Hooked up to FaceTime camera on macbook
"""
from torchvision import transforms
from PIL import Image
import torch
import torch.nn as nn
import numpy as np
import torch
from torch import nn
from torch.optim import SGD
# Train a network to recognize the function y=2x+3
class LinReg(nn.Module):
"""
@a10y
a10y / orbital_benchmark.log
Created December 12, 2021 03:46
pyorbital benchmarking
~ :: python -m timeit -v -s 'import pyorbital.orbital as O; from numpy import atleast_1d; from datetime import datetime;' 'Az, Elev = O.get_observer_look(atleast_1d(10), atleast_1d(10), atleast_1d(50_000), datetime.utcnow(), atleast_1d(10), atleast_1d(10), atleast_1d(6_00))'
1 loop -> 0.00024 secs
2 loops -> 0.000296 secs
5 loops -> 0.000333 secs
/Users/andrew/miniforge3/lib/python3.9/site-packages/pyorbital/orbital.py:129: RuntimeWarning: invalid value encountered in true_divide
az_ = np.arctan(-top_e / top_s)
/Users/andrew/miniforge3/lib/python3.9/site-packages/pyorbital/orbital.py:149: RuntimeWarning: invalid value encountered in arcsin
el_ = np.arcsin(top_z / rg_)
10 loops -> 0.000919 secs
/Users/andrew/miniforge3/lib/python3.9/site-packages/pyorbital/orbital.py:129: RuntimeWarning: divide by zero encountered in true_divide