This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start_server --port=5001 -- node server.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subtest "reproxy and server-push" => sub { | |
plan skip_all => 'nghttp not found' | |
unless prog_exists('nghttp'); | |
my $server = spawn_h2o(<< "EOT"); | |
hosts: | |
default: | |
paths: | |
/: | |
reproxy: ON | |
mruby.handler: | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"arm-none-eabi-size" -B -d .pioenvs/lpc1114fn28/firmware.elf | |
text data bss dec hex filename | |
17476 128 440 18044 467c .pioenvs/lpc1114fn28/firmware.elf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arm-none-eabi-objcopy -O binary .pioenvs/lpc1114fn28/firmware.elf .pioenvs/lpc1114fn28/firmware.bin | |
text data bss dec hex filename | |
22948 124 340 23412 5b74 .pioenvs/lpc1114fn28/firmware.elf | |
arm-none-eabi-g++ --version | |
arm-none-eabi-g++ (GNU Tools for ARM Embedded Processors) 4.8.4 20140725 (release) [ARM/embedded-4_8-branch revision 213147] | |
Copyright (C) 2013 Free Software Foundation, Inc. | |
This is free software; see the source for copying conditions. There is NO | |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sizeof(template) | |
x = Class.new(Numeric) do | |
def to_str; ""; end | |
def to_int; 0; end | |
# implicit to_f is called only with Numeric subclass | |
def to_f; 0.0; end | |
end.new | |
size = template.scan(/([a-zA-Z][_!]?[<>]?)([0-9]*)/).reduce(0) {|r,(_,n)| | |
r + (n.empty?? 1 : n.to_i) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!ruby -v | |
string = "\xA9foobar".force_encoding("ASCII-8BIT") | |
p string.unpack("C*") == "\xA9foobar".unpack("C*") | |
#=> true | |
p string == "\xA9foobar" | |
#=> false (depends on magic comment, default literal is UTF-8) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "serialport" | |
SerialPort.class_eval do | |
TCGETS2 = 0x802c542a | |
TCSETS2 = 0x402c542b | |
CBAUD = 0x100f | |
BOTHER = 0x1000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <ESP8266WiFi.h> | |
#include <WiFiUdp.h> | |
#include "rtc_memory.hpp" | |
#include "config.h" | |
WiFiClient wifiClient; | |
struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
// デストラクタで func を実行するだけ | |
template <class T> | |
class ScopeGuard { | |
const T func; | |
public: | |
ScopeGuard(T f) : func(f) {} | |
~ScopeGuard() { | |
func(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <stdint.h> | |
#include <iostream> | |
template <class T, class U> | |
void is(T got, U expected) { | |
if (got == expected) { | |
std::cout << "ok" << std::endl; | |
} else { | |
std::cout << "not ok " << got << " != " << expected << std::endl; | |
} |