Skip to content

Instantly share code, notes, and snippets.

@ryo1kato
ryo1kato / mAh-meter.ino
Created March 27, 2017 08:54
amp-hour meter
const uint32_t shuntMilliOhm = 10100;
const uint32_t refMilliVoltage = 1100;
const int sensorPin = A0;
const int updateIntervalMsec = 500;
void setup() {
Serial.begin(9600);
analogReference(INTERNAL);
Serial.println("");
@ryo1kato
ryo1kato / pyserial.py
Created February 25, 2017 19:00
UART read/write with Arduino using pyserial
ser = serial.Serial(port='/dev/tty.wchusbserial1420',
baudrate=115200,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS)
ser.write("string");
ser.read(99)
/* *************************************************************************** *
* Tiny sample shell using msh routines.
* *************************************************************************** */
#include "picoshell.h"
#include "picoshell_termesc.h"
#define PUTS_BLUE_BACK(charp) \
{ \
/* *************************************************************************** *
* Tiny sample shell using routines for Arduino.
* *************************************************************************** */
#include "picoshell.h"
#include "picoshell_termesc.h"
#define PUTS_BLUE_BACK(charp) \
{ \
@ryo1kato
ryo1kato / hue-toggle
Created December 21, 2016 05:02
hue toggle script for hue-cli
#!/bin/bash
# SETUP:
# Install hue-cli and register it to a Hue bridge first:
# $ npm install -g hue-cli
# Search the bridge IP
# $ hue search
# 1 stations found
# 1: 192.168.0.106
## Then register the CLI to the bridge
@ryo1kato
ryo1kato / gist:8e340b5c1c2cb5c54bfb90443045804f
Created November 22, 2016 08:22
Progress Bar for PowerPoint slides
Sub AddProgressBar()
On Error Resume Next
With ActivePresentation
For X = 1 To .Slides.Count
.Slides(X).Shapes("PB").Delete
Set s = .Slides(X).Shapes.AddShape(msoShapeRectangle, _
0, .PageSetup.SlideHeight - 5, _
X * .PageSetup.SlideWidth / .Slides.Count, 5)
s.Fill.ForeColor.RGB = RGB(127, 0, 0)
s.Fill.BackColor.RGB = RGB(127, 0, 0)
--- Desktop/DB410c_build.sh.txt 2016-07-10 17:16:22.000000000 -0700
+++ Desktop/DB410c_build.sh.txt.new 2016-07-10 19:34:36.000000000 -0700
@@ -8,14 +8,23 @@
CAFTAG="LA.BR.1.2.4-01810-8x16.0.xml"
function SBC410C_SOURCE_CODE() {
-# Do repo sanity test
-if [ $? -eq 0 ]
+if : "run repo sanity test here in the future"
then
master$ ./perftest.sh | tee out
Caching the file...
#---- Testing for /zzzz/ ----
egrep,0.136,0.090,0.045
amlgrep,3.127,3.106,0.107
hmlgrep,0.418,0.363,0.053
rmlgrep,53.629,53.554,0.073
pymlgrep,12.103,12.027,0.073
#---- Testing for /SPARSE$/ ----
egrep,0.186,0.141,0.044
#!/usr/bin/env python
desc="100x faster uniq(1) implementation with hash - you don't have to sort."
import sys
import argparse
parser = argparse.ArgumentParser(description=desc)
parser.add_argument('-c', '--count', action='store_true',
help='Precede each output line with the count of the number of times'
@-moz-document url-prefix("https://ballard.amazon.com") {
span.wf-owa-flag-on {
background-color: #FF9999;
border: solid 2px red;
}
span.wf-owa-attachment-small {
border: solid 2px blue;
background-color: #9999FF;
}