Skip to content

Instantly share code, notes, and snippets.

View louisaslett's full-sized avatar
🤓

Louis Aslett louisaslett

🤓
View GitHub Profile
@louisaslett
louisaslett / matrix-inv.R
Created October 24, 2024 21:44
#rstats matrix inversion
# Script to compare matrix inversion speeds of base R, Matrix and torch packages
# Also shows double -vs- single precision torch speeds (see output.txt for results on M1 Mac)
library("Matrix")
library("torch")
base <- microbenchmark::microbenchmark(
b <- solve(a),
setup = {
a <- matrix(rnorm(1600*1600), 1600)
@louisaslett
louisaslett / cryptorng-test.qmd
Last active April 25, 2024 10:41
Simple test for coolbutuseless/cryptorng
---
title: ""
format: html
---
[https://fosstodon.org/@coolbutuseless/112329375557579427](https://fosstodon.org/@coolbutuseless/112329375557579427)
```{r}
# Quick script to do a simple test of uniform byte generator in package
# coolbutuseless/cryptorng which uses OS level cryptographic RNGs
@louisaslett
louisaslett / proxy-toggle.sh
Created August 18, 2020 08:47 — forked from dgoguerra/proxy-toggle.sh
Script to toggle Mac OS X SOCKS proxy, and setup a SOCKS server with SSH
#!/bin/sh
PROXY_INTERFACE="Wi-Fi"
PROXY_HOST=127.0.0.1
PROXY_PORT=1080
# A host where ssh can login without interaction, with a key-based
# authentication.
SOCKS_PROC_USER="username"
SOCKS_PROC_HOST="example.com"
@louisaslett
louisaslett / ec2-spot-price.sh
Last active April 17, 2022 17:41
Check Amazon EC2 spot prices for an instance type across all regions
#!/bin/bash
# 0. Ensure AWS CLI tool installed: pip install awscli
# 1. Make shell script executable: chmod u+x ec2-spot-prices.sh
# 2. Run script and provide instance type to check: ./ec2-spot-prices.sh c4.8xlarge
# 3. Script runs and outputs full stops while querying the Amazon API,
# returning three columns: Region+AZ, Instance Type, Current Spot Price in $
allSpot=""
for Reg in eu-west-1 eu-west-2 eu-west-3 eu-central-1 eu-north-1 ca-central-1 us-east-1 us-east-2 us-west-1 us-west-2 sa-east-1 ap-southeast-1 ap-northeast-1 ap-east-1 ap-northeast-2 ap-southeast-2 ap-south-1