Skip to content

Instantly share code, notes, and snippets.

View ryanwoodsmall's full-sized avatar
🍞
🍞 bread 🍞 sandwich 🍞

ryan ryanwoodsmall

🍞
🍞 bread 🍞 sandwich 🍞
View GitHub Profile
@ryanwoodsmall
ryanwoodsmall / extremely_dangerous_ssh_config
Last active October 3, 2021 01:56
~/.ssh/config settings you should never, ever use
Host *
AddKeysToAgent yes
ForwardAgent yes
HostKeyAlgorithms +ssh-rsa
KexAlgorithms +diffie-hellman-group1-sha1
LogLevel QUIET
PubkeyAcceptedKeyTypes +ssh-rsa
ServerAliveCountMax 10
ServerAliveInterval 30
StrictHostKeyChecking no
@ryanwoodsmall
ryanwoodsmall / cpu_mem.py
Created July 12, 2016 15:38
get CPU counts and memory in bytes for Python on Linux
import re
def get_cpu_count():
cpu_count = 0
cpu_file = '/proc/cpuinfo'
ch = open(cpu_file, 'r')
for line in ch:
if re.match('processor', line):
cpu_count = cpu_count + 1
ch.close()
@ryanwoodsmall
ryanwoodsmall / jcecheck.java
Created July 7, 2016 18:02
JCE unlimited strength crypto checker
// exit code 0 if JCE is available, 1 otherwise
/*
* one-liner:
* jrunscript -e 'exit (javax.crypto.Cipher.getMaxAllowedKeyLength("AES") < 256);'
*/
import javax.crypto.Cipher;
public class jcecheck {
@ryanwoodsmall
ryanwoodsmall / jsysprop.java
Last active November 3, 2016 19:33
dump java system properites
/*
* single command version:
* jrunscript -e 'java.lang.System.getProperties().list(java.lang.System.out);'
*/
import java.util.Properties;
public class jsysprop {
public static void main(String[] args) {
System.getProperties().list(System.out);
@ryanwoodsmall
ryanwoodsmall / myexpt.scm
Last active December 28, 2019 08:06
quick and dirty "x ^ y" power function in scheme to raise a base to an exponent
(define (myabs x)
(cond ((< x 0) (* x -1))
((x >= 0) (* x 1))))
(define (myexpt x y)
(cond ((< x 0) (* (cond ((odd? (myabs y)) -1)
(else 1))
(myexpt (myabs x) y)))
((< y 0) (/ 1 (myexpt x (myabs y))))
((= y 0) 1)