Skip to content

Instantly share code, notes, and snippets.

View stephancom's full-sized avatar

stephan.com stephancom

View GitHub Profile
@standarddeviant
standarddeviant / wake_on_motion_from_deep_sleep.ino
Created July 6, 2020 03:38
M5StickC wake-on-motion MPU6886 interrupt IMU motion MPU
#include <Arduino.h>
#include <M5StickC.h>
#include <utility/MPU6886.h> // used for accessing MPU constants
#include <driver/rtc_io.h>
void mpu6886_wake_on_motion_isr(void); // declaration of ISR
void mpu6886_wake_on_motion_setup(void); // declaration of setup
// lifted from https://github.com/m5stack/M5StickC/blob/master/src/utility/MPU6886.cpp
// if integrated with M5StickC library, use internal class function instead
watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/npm-* && rm -rf $TMPDIR/haste-* && rm -rf $TMPDIR/metro-* && rm -rf node_modules && npm install && rm -rf ios/Pods && cd ios && pod cache clean --all && pod repo update && pod install && ./android/gradlew clean -p ./android/ && rm -rf ios/build && rm -rf ~/Library/Developer/Xcode/DerivedData && npm start -- --reset-cache
@bobchao
bobchao / m_test.txt
Created December 22, 2017 14:08
cubiio - g-code file for power / speed combinations testing.
M05 S0
G90
G21
G1 F600
G1 X-40.225 Y39.6688
G4 P0
M03 S255
G4 P0
G1 F600.000000
@nebman
nebman / display-example.ino
Created November 17, 2017 09:36
Example code for Wifi Kit 8, ESP8266 Oled, HTIT-W8266
#include <Arduino.h>
#include <U8x8lib.h>
// Pin 16 OLED Reset
// Pin 4,5 I2C
// use Board "Wemos D1 Mini R2", 80Mhz, 4(3)MB Flash, 921600baud to flash
U8X8_SSD1306_128X32_UNIVISION_HW_I2C u8x8(16);
module TableHelpers
module ArrayMethods
def find_row(expected_row)
find_index do |row|
expected_row.all? do |expected_column|
first_column = row.find_index do |column|
content = normalize_content(column.content)
expected_content = normalize_content(expected_column)
matching_parts = expected_content.split(/\s*\*\s*/, -1).collect { |part| Regexp.escape(part) }
@robertsdionne
robertsdionne / deepdream-install.md
Last active February 15, 2021 16:07
Deepdream installation
#!/usr/bin/env bash

# Assuming OS X Yosemite 10.10.4

# Install XCode and command line tools
# See https://itunes.apple.com/us/app/xcode/id497799835?mt=12#
# See https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcode-select.1.html
xcode-select --install
<input
ng-model="searchPhrase"
ng-model-options="{debounce: 500}"
ng-change="getResults(searchPhrase)"></input>
@JamesHagerman
JamesHagerman / gist:3662fa257366f5f4345f
Last active August 29, 2015 14:17
RedCloth + Monkey Patch = Prism working
# RedCloth doesn't work well with the Prism syntax highlighting lirbary due to the way it handles <code> blocks when it comes to newlines using bc..
# But we can add a config/initializers/redcloth.yml file to our Rails app and monkey patch it so it does.
#
# So, this monkey patch is to make RedCloth not split the bc.. code blocks on newlines.
# To actually use it with Prism the syntax should look like this:
# bc(language-ruby).. whatever multi-line code you want to display goes here
module RedCloth::Formatters::HTML
def bc_open(opts)
opts[:block] = true
"<pre#{pba(opts)}><code>"
@dolzenko
dolzenko / sidekiq_paper_trail_middleware.rb
Created December 18, 2014 13:01
Make originator of change tracked with paper_trail available in Sidekiq background workers
module Acme
module Sidekiq
module PaperTrailMiddleware
class Client
# @param [Object]
# @param [Hash] job
def call(_, job, *)
job['whodunnit'] = ::PaperTrail.whodunnit
yield
end