Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond. Ping me on Twitter instead:

Christoph Grabo asaaki

I may be slow to respond. Ping me on Twitter instead:
Block or report user

Report or block asaaki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ruby-sigils.rb
[*('A'..'Z'), *('a'..'z')].map do |c|
puts [c, eval("%#{c}(ls)")].inspect
rescue Exception
puts "#{c} not allowed"
end; 0
asaaki / experiments.rb
Created May 16, 2019
Some Ruby stdlib experiments
View experiments.rb
### Experiments
log =
queue =
group = # pool
5.times do |i|
asaaki / flurlicht.ino
Created Jan 30, 2019
motion sensor / interrupt triggered neopixel light controller
View flurlicht.ino
#include <Adafruit_NeoPixel.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <avr/sleep.h>
#define STRIP_PIN 6
#define TRIGGER_PIN 2
#define CONTROL_LED 13
// Note: this duration should be also longer than the HIGH time of the PIR
asaaki /
Created Oct 22, 2018
(rustup) add or remove list of targets for a list of toolchains
targets=(armv7-unknown-linux-musleabihf thumbv7em-none-eabi armv7-unknown-linux-musleabihf)
toolchains=(stable beta nightly)
for toolchain in $toolchains; do
for target in $targets; do
echo "--> toolchain $toolchain and target $target"
rustup target install $target --toolchain $toolchain
# rustup target remove $target --toolchain $toolchain
View callables_spec.rb
require 'spec_helper'
module CallableSubject
def callable_subject(&_block)
subject { -> { yield } }
RSpec.configure do |c|
asaaki /
Created Jan 26, 2018 — forked from anonymous/
Rust code shared from the playground
use std::ops::Deref;
struct StateFn(fn(&mut Machine) -> StateFn);
impl Deref for StateFn {
type Target = fn(&mut Machine) -> StateFn;
fn deref(&self) -> &Self::Target {
asaaki /
Last active Jan 26, 2018
Rust-to-JS JSON string exchange (parcel.js, wasm)

Rust, serde-json, wasm, parcel.js

With this combination it is fairly easy to get things done in Rust and utilize it in JavaScript. Yay!

asaaki /
Last active Jan 26, 2018
parcel.js/Rust: return a string
gist is: return a ref to c_char and the length of it (via 2 functions)
C example:
use std::ffi::CString;
use std::os::raw::c_char;
static HELLO: &'static str = "hello from rust";
asaaki / private_constants.rb
Created Nov 1, 2017
[Ruby] Private constants check
View private_constants.rb
require 'active_support'
module MyConcern
extend ActiveSupport::Concern
class PrivateClass
def self.pcall
You can’t perform that action at this time.