Skip to content

Instantly share code, notes, and snippets.

View Thomascountz's full-sized avatar
💃
LGTM!

Thomas Countz Thomascountz

💃
LGTM!
View GitHub Profile
@todbot
todbot / synthio_midi_synth.py
Last active February 20, 2024 18:01
pretty usable MIDI-controlled synth using synthio in CircuitPython
# synthio_midi_synth.py - pretty usable MIDI-controlled synth using synthio in CircuitPython
# 11 May 2023 - @todbot / Tod Kurt
# Uses cheapie PCM5102 DAC on QTPY RP2040
# Video demo: https://www.youtube.com/watch?v=N-PbbWWDE6k
# Features:
# - midi velocity controls attack rate (gentle press = slow, hard press = fast)
# - notes have small random detune on all oscillators to reduce phase stacking
# - adjustable number of detuned oscillators per note 1-5 (midi controller 83)
# - five selectable waveforms: saw, squ, sin, noisy sin, noise (midi controller 82)
# - vibrato depth on mod wheel (midi controller 1)
@BaseCase
BaseCase / grid-demo.html
Created September 26, 2021 18:35
basic centered grid
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Layout demo</title>
<style>
* {
box-sizing: border-box;
}
@iscott
iscott / simple_authentication_rails_5_bcrypt_and_has_secure_password.md
Last active May 6, 2024 19:57
Cheat Sheet: Simple Authentication in Rails 5 with has_secure_password

Cheat Sheet: Simple Authentication in Rails 6 with has_secure_password

The goal of this cheatsheet is to make it easy to add hand-rolled authentication to any rails app in a series of layers.

First the simplest/core layers, then optional layers depending on which features/functionality you want.

Specs
AUTHOR Ira Herman
LANGUAGE/STACK Ruby on Rails Version 4, 5, or 6
@willprice
willprice / .travis.yml
Last active August 15, 2023 17:12
How to set up TravisCI for projects that push back to github
# Ruby is our language as asciidoctor is a ruby gem.
lang: ruby
before_install:
- sudo apt-get install pandoc
- gem install asciidoctor
script:
- make
after_success:
- .travis/push.sh
env:
@O-I
O-I / univariate_polynomial_roots.rb
Last active July 31, 2019 22:26
Ruby univariate polynomial root finder
require 'matrix'
# Input: an array of the n coefficients [a_n, a_n-1,..., a_1] of
# a univariate polynomial p of degree n ([a_n]x^n + [a_n-1]x^n-1 + ... + a_1)
#
# Output: an array of all n roots of p
#
# Exploits the fact that the eigenvalues of the companion matrix of the
# monic equivalent of p are the roots of p
#
@steos
steos / Kepler.java
Created December 18, 2010 01:40
calculate orbital satellite position using Kepler's laws
import static java.lang.Math.*;
public class Kepler
{
public static class Point2d
{
public double x;
public double y;
public Point2d(double x, double y)