Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am lindsaylandry on github.
  • I am angryballoon (https://keybase.io/angryballoon) on keybase.
  • I have a public key ASDtYTLFBUR0eHW0YVCKptt8lXhkW9gZrPzRwvsgqzPikwo

To claim this, I am signing this object:

@lindsaylandry
lindsaylandry / randomcollider.go
Created November 16, 2018 19:00
test how many strings can be generated before a collision
package main
import (
"fmt"
"math/rand"
"time"
)
func GenerateRandomString(n int) string {
letterBytes := "abcdefghijklmnopqrstuvwxyz"
@lindsaylandry
lindsaylandry / backlight.service
Last active April 30, 2017 20:16
retropie: /etc/systemd/system/backlight.service
[Unit]
Description=Backlight Service
[Service]
ExecStart=/usr/local/bin/backlight.py
StandardOutput=null
[Install]
WantedBy=multi-user.target
Alias=backlight.service
@lindsaylandry
lindsaylandry / pigrrl_backlight.py
Created March 14, 2017 12:56
script to adjust the backlight of pigrrl zero and zero plus using GPIO 27
import os
from time import sleep
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP)
os.system("gpio -g mode 18 pwm")
os.system("gpio -g pwm 18 1023")
nums = [1023, 500, 200, 50]
# Valid command line args:
# int=<integer>
# roman=<roman numeral>
M = 1000
D = 500
C = 100
L = 50
X = 10
V = 5
#!/usr/bin/env ruby
require 'matrix'
def number_of_routes(start, n)
# 0 1 2 3 4 6 7 8 9
a = Matrix[[0, 0, 0, 0, 1, 1, 0, 0, 0], #0
[0, 0, 0, 0, 0, 1, 0, 1, 0], #1
[0, 0, 0, 0, 0, 0, 1, 0, 1], #2
[0, 0, 0, 0, 1, 0, 0, 1, 0], #3
-- 31: Determine whether a number is prime
isPrime :: Int -> Bool
isPrime x
| x <= 0 = False
| x == 1 = False
| otherwise = sum [ 1 | s <- [2,3..floor(sqrt(fromIntegral x))], x `mod` s == 0 ] == 0
-- 32 Determine greatest common divisor of 2 positive integers. Use Euclid's algorithm
greatestCommonDivisor :: Int -> Int -> Int
greatestCommonDivisor x y