Skip to content

Instantly share code, notes, and snippets.

View evanmiller67's full-sized avatar

Evan Miller evanmiller67

View GitHub Profile
@evanmiller67
evanmiller67 / .bash_aliases
Created January 26, 2023 20:18
Whitenoise aliases
# TODO: ensure present
# Whitenoise generation
alias brownnoise='play -qn -t sl -r48000 -c2 - synth -1 brownnoise tremolo .1 20 < /dev/zero &'
alias pinknoise='play -qn -t sl -r48000 -c2 - synth -1 pinknoise tremolo .1 30 < /dev/zero &'
alias whitenoise='play -qn -t sl -r48000 -c2 - synth -1 whitenoise tremolo .1 40 < /dev/zero &'
alias noises='play --no-show-progress -c 2 --null synth brownnoise band -n 2 300 tremolo .1 20 reverb 10 bass -10 treble -1 vol 10dB < /dev/zero & play --no-show-progress -c 2 --null synth brownnoise band -n 2 300 tremolo .1 20 reverb 10 bass -10 treble -1 vol 10dB < /dev/zero & play --no-show-progress -c 2 --null synth brownnoise band -n 2 300 tremolo .1 20 reverb 10 bass -10 treble -1 vol 10dB < /dev/zero & play --no-show-progress -c 2 --null synth brownnoise band -n 2 300 tremolo .1 20 reverb 10 bass -10 treble -1 vol 10dB < /dev/zero &'
@evanmiller67
evanmiller67 / req_retry.py
Last active April 15, 2020 14:11
sample retries in python
def retry(fxn, **kwargs):
num_retries = 3
backoff_factor = 0.3
# status_forcelist = (500, 502, 503, 504)
for i in range(num_retries):
try:
return fxn(kwags)
except RetryError as err:
if i >= 1 and i < num_retries - 1: # and err.code in status_forcelist:
sleep(backoff_factor * 2**(i - 1))
@evanmiller67
evanmiller67 / console_output.log
Created September 18, 2015 15:57
samlr/nokogiri issues
$ irb
~> Console extensions: wirble hirb ap rails2 rails3 pm interactive_editor
>> require 'samlr'
=> true
>> response = Samlr::Tools::ResponseBuilder.build({destination: 'foo_url', in_response_to: Samlr::Tools::uuid, name_id: '123456', not_on_or_after: Samlr::Tools::Timestamp.stamp(Time.now + 600), not_before: Samlr::Tools::Timestamp.stamp(Time.now - 600), audience: 'bar_peeps', attributes: { 'attr1' => 'attr1_val', 'attr2' => 'attr2_val'}})
=> "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<samlp:Response Destination=\"foo_url\" ID=\"samlr-97bd62c0-5e1a-11e5-ae2e-44fb42fffe0e\" InResponseTo=\"samlr-97b1ca00-5e1a-11e5-ae2e-44fb42fffe0e\" IssueInstant=\"2015-09-18T15:33:21Z\" Version=\"2.0\" xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\" xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\"><saml:Issuer>ResponseBuilder IdP</saml:Issuer><Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"/><SignatureMethod Algorithm
@evanmiller67
evanmiller67 / evan_sets.erl
Created November 13, 2014 19:59
Sample CRUD operations for sets.
-module(evan_sets).
-compile(export_all).
create(Set, Element) ->
sets:add_element(Element, Set).
read(Set, Element) ->
case sets:is_element(Element, Set) of
true ->
@evanmiller67
evanmiller67 / benchmark.rb
Created September 8, 2014 18:57
i18n hash benchmark and results
#!/usr/bin/env ruby
require 'benchmark'
require 'digest'
require 'xxhash'
md5 = Digest::MD5.new
sha1 = Digest::SHA1.new
rmd160 = Digest::RMD160.new
sha256 = Digest::SHA256.new
@evanmiller67
evanmiller67 / my.cnf
Created May 1, 2013 16:41
MySQL conf file for OS X 10.8.3 with MySQL version 5.6.x. Make sure that all folders are owned by your user account, or have permissions to them.
# Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208
# Configuration name mysql-gazelle generated for yellow5c@gmail.com at 2012-07-26 16:25:45
[mysql]
# CLIENT #
port = 3306
socket = /usr/local/var/run/mysqld/mysqld.sock
[mysqld]
@evanmiller67
evanmiller67 / chili_con_carne.md
Created December 14, 2012 17:18
Frakin' good chili.

Chili Con Carne

=============== This shit is awesome. It's hot, so nut up pansy.
Don't like it that way? Leave out some peppers and spices.
Green bell pepper is for color, substitute another red or yellow for a sweeter taste.
Like different beans? Add them shits too, get wild with Emeril.
Want this to be even better? Cook/mix everything the night before, put in the fridge. Then cook it all day.

Ingredients