This file contains 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
const uint8_t sw_out = 9; | |
uint16_t target_value = 1023; | |
const uint8_t segments_pin[] = {0, 1, 2, 3, 4, 5, 6}; | |
const uint8_t orders_pin[] = {A4, A3, A2, A1, 13, 12, 11, 10}; | |
const uint8_t segments_count = 7; | |
const uint8_t orders_count = 8; | |
const uint8_t segment_data[] = { | |
0b11111100,//0 | |
0b01100000,//1 |
This file contains 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
$sudo apt-get install libopencv-dev | |
$mkdir hellocv | |
$cd hellocv | |
$mkdir lib | |
#get opencv-2XX.jar and copy into hellocv/lib | |
#sudo dpkg -L libopencv-dev | |
$cp /usr/share/OpenCV/java/opencv-248.jar lib/ | |
$sbt run |
This file contains 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
using Sprache; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace lambda_calc | |
{ | |
abstract class Statement { } | |
abstract class Expr : Statement |
This file contains 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 loopSeq = ((0 to 0xff) ++ (0x0 to 0xff).reverse) | |
val arr = {loopSeq map{x => s"{ $x, 0, 0,}, "}} ++ | |
{loopSeq map{x => s"{ 0, $x, 0,}, "}} ++ | |
{loopSeq map{x => s"{ 0, 0, $x,}, "}} ++ | |
{loopSeq map{x => s"{ $x, $x, 0,}, "}} ++ | |
{loopSeq map{x => s"{ 0, $x, $x,}, "}} ++ | |
{loopSeq map{x => s"{ $x, 0, $x,}, "}} ++ | |
{loopSeq map{x => s"{ $x, $x, $x,}, "}} |
This file contains 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 <stdio.h> | |
typedef unsigned short uint16; | |
typedef unsigned char uint8; | |
const char numberTable[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; | |
void itoa(uint16 src, char* buf){ | |
uint8 i; | |
buf[0] = '0'; | |
buf[1] = 'x'; |
This file contains 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 <stdio.h> | |
// 未知数の数/方程式の数 | |
#define N 2 | |
int main(void){ | |
// x + 2y = 5 | |
//2x + 3y = 8 | |
double matrix[N][N + 1] = { | |
{ 1, 2, 5 }, |
This file contains 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
#ifndef IMAGEDATA_H_ | |
#define IMAGEDATA_H_ | |
#include <avr/pgmspace.h> | |
PROGMEM const uint8_t img_src[240][50] = { | |
{ 0x7, 0xf8, 0xff, 0xff, 0x3, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x31, 0xfe, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, }, | |
{ 0xc0, 0xff, 0xff, 0xff, 0xff, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x19, 0xff, 0xff, 0x8f, 0xff, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, }, | |
{ 0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x99, 0xff, 0xff, 0xc7, 0xff, 0xff, 0x83, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, |
This file contains 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
object Main { | |
implicit class Point[T <% Double](val self:(T,T)) { | |
lazy val abs = math.sqrt(self._1 * self._1 + self._2 * self._2) | |
def -[U <% Double](p:(U,U)) = (self._1 - p._1, self._2 - p._2) | |
def cross[U <% Double](p:(U,U)) = self._1 * p._2 - self._2 * p._1 | |
} | |
def crossProduct[T <% Double](polygon:List[(T,T)],points:List[(T,T)]) : List[List[Double]] = | |
points.map { p => polygon zip(polygon.tail :+ polygon.head) map{ case(a,b) => (a - p) cross (b - p)} } | |
def isCrossVector(xs:List[Double]) : Boolean = xs.forall(_ > 0) || xs.forall(_ < 0) | |
def isCross[T <% Double](poly1:List[(T,T)],poly2:List[(T,T)]) : Boolean = |
This file contains 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
import scala.collection.immutable.Stack | |
object Main { | |
def binOp(q:Stack[Double])(f:(Double,Double) => Double) : Stack[Double] = { | |
val (b,q2) = q.pop2 | |
val (a,q3) = q2.pop2 | |
q3.push(f(a,b)) | |
} | |
def unaryOp(q:Stack[Double])(f:(Double) => Double) : Stack[Double] = { | |
val (a,q2) = q.pop2 |
This file contains 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
println(((s:String) => s.drop(5 + 7).take(5).zip(s.drop(5).take(7)).zip(s.take(5)).map{case ((a,b),c) => s"$a $b $c"}.++(s.drop(5 + 5).take(2).map{x => s" $x"}).mkString("\r\n"))("なかぬならなかせてみようホトトギス")) |