Skip to content

Instantly share code, notes, and snippets.

Tony Arcieri tarcieri

View GitHub Profile
@tarcieri
tarcieri / blinky_basic.rs
Created Mar 5, 2019
NeoTrellis M4 Rust blinky_basic example
View blinky_basic.rs
#![no_std]
#![no_main]
extern crate cortex_m;
extern crate trellis_m4 as hal;
extern crate panic_halt;
extern crate smart_leds;
extern crate smart_leds_trait;
extern crate ws2812_timer_delay as ws2812;
View async.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tarcieri
tarcieri / experimental.svg
Created Apr 21, 2017
DANGER: EXPERIMENTAL
View experimental.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View lifetime_hell_part_2.rs
use std::marker::PhantomData;
pub trait MyTrait<'a> {
fn new() -> Self;
fn derpity(&'a self);
}
struct Derp;
impl<'a> MyTrait<'a> for Derp {
@tarcieri
tarcieri / lifetime_hell.rs
Created Oct 31, 2016
Generics, traits, and lifetimes, oh my!
View lifetime_hell.rs
pub trait MyTrait<'a> {
fn foo(n: &'a i32);
}
struct Derp;
impl<'a> MyTrait<'a> for Derp {
fn foo(n: &'a i32) {
}
}
@tarcieri
tarcieri / example.fling
Created Jun 14, 2015
Example fling configuration
View example.fling
-----BEGIN ENCRYPTED FLING CONFIGURATION-----
FTTKvMlxv0rs0ACBydlXFHZHYmKQtRUN6PlwI4ZW5gYXV57u/zO90KRD0Nn2
Buj3/CsJGgbWx5fM2X8eGJKRryuZ7eNSm9C0doq2lRikrqV+gsBNqa0e/lkc
P4b8q7GfZyralBwvMTBnoOhmUtNPM1orafFIhSYI6wN2ZKpnZgAar9NQRkxZ
LJWTvqzlWVdZ6ranCzmRJhAClr7822GylXIIeOycpm8EC8ESRRmiaYMJMPxe
3BBlk1KuTTnU4WVDbJVW/9f9+zcZViZDUTyNt5LougR8LLC8FbN1p+UiLSWx
CZA940Mo/DVWN29uJL8FitY8mJDZEJ8/OJr/5zptzAFaj0zhs+uLafjvI96D
------END ENCRYPTED FLING CONFIGURATION------
@tarcieri
tarcieri / gist:95f41af8751e765f5ac2
Created Apr 29, 2015
rails-assets.org's 4096-bit DH breaks JRuby :(
View gist:95f41af8751e765f5ac2
Using /Users/tonyarcieri/.rvm/gems/jruby-1.7.19
$ gem install rails-assets-jruby --source "https://rails-assets.org"
ERROR: While executing gem ... (Java::JavaLang::RuntimeException)
Could not generate DH keypair
View gist:484d4843e355303cf730
$ gem install irust
Successfully installed irust-1.2.0
Parsing documentation for irust-1.2.0
Done installing documentation for irust after 0 seconds
1 gem installed
$ irust
Using rustc 1.0.0-nightly (083b8a404 2015-04-05) (built 2015-04-04)
irust> let mut nums = [1,2,3,4,5,6];
()
irust> nums
@tarcieri
tarcieri / gist:6bf23d9b69b499b3a313
Created Mar 26, 2015
Ruby HTTP client benchmark
View gist:6bf23d9b69b499b3a313
+--------------------------+-----------+
| tach | total |
+--------------------------+-----------+
| curb (persistent) | 2.519088 |
+--------------------------+-----------+
| em-http-request | 2.731645 |
+--------------------------+-----------+
| Typhoeus | 2.851911 |
+--------------------------+-----------+
| StreamlyFFI (persistent) | 2.853786 |
@tarcieri
tarcieri / hostname_verifier.rb
Last active Aug 29, 2015
Strawman hostname verifier that doesn't rely on regular expressions
View hostname_verifier.rb
def verify_domain_component(san_component, domain_component)
parts = san_component.split("*", -1)
return false if parts.size > 2
return san_component == domain_component if parts.size == 1
domain_component.start_with?(parts[0]) && domain_component.end_with?(parts[1])
end
fail unless verify_domain_component("foo", "foo")
fail unless verify_domain_component("f*", "foo")
You can’t perform that action at this time.