Skip to content

Instantly share code, notes, and snippets.

View AlexanderSavochkin's full-sized avatar

Alexander Savochkin AlexanderSavochkin

  • Greater Seattle Area
View GitHub Profile
@AlexanderSavochkin
AlexanderSavochkin / dijkstra.hs
Created June 10, 2013 06:59
This is example of using STArray for Dijkstra algorithm implementation in Haskell.
{--
Author: Alexander Savochkin
This is example of using STArray for Dijkstra algorithm implementation in Haskell.
--}
module Main where
import Data.Char
import Data.Array
import Data.Array.ST
@AlexanderSavochkin
AlexanderSavochkin / software_serial_ino.ino
Created July 23, 2014 20:52
Software serial interconnection
#include <SoftwareSerial.h>
SoftwareSerial softSerial(10, 11); // RX, TX
enum { LED_PIN = 13 };
void setup()
{
pinMode(LED_PIN, OUTPUT);
softSerial.begin(9600);
@AlexanderSavochkin
AlexanderSavochkin / hardware_serial_ino.ino
Created July 23, 2014 23:04
Arduino hardware serial interconnection example
enum { LED_PIN = 13 };
void setup()
{
pinMode(LED_PIN, OUTPUT);
Serial.begin(9600);
}
void loop()
{
@AlexanderSavochkin
AlexanderSavochkin / SimpleThermometer.ino
Last active May 28, 2024 18:06
Simple arduino 2-sensors (DS18B20) termometer + I2C LCD sketch
//I2C bus support
#include <Wire.h>
//I2C
#include <LiquidCrystal_I2C.h>
//OneWire bus suport
#include <OneWire.h>
//DS18B20 temperature sensor support
#include <DallasTemperature.h>
//DS18B20 sensor pin
#define ONE_WIRE_BUS 8
@AlexanderSavochkin
AlexanderSavochkin / ColorShieldApi.ino
Created July 21, 2015 05:49
Arduino ColorShield API description
//В заголовочном файле Colorduino.h определяется структура pixelRGB,
typedef struct pixelRGB {
unsigned char r;
unsigned char g;
unsigned char b;
} PixelRGB;
//...а так же класс ColorduinoObject,
class ColorduinoObject {
...
//Font
char font8x8_basic[10][8] = {
{ 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0)
{ 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1)
{ 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2)
{ 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3)
{ 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4)
{ 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5)
{ 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6)
{ 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7)
@AlexanderSavochkin
AlexanderSavochkin / PrintSymbol.ino
Created July 21, 2015 06:39
Print symbol function
void PrintSymbol(short code, ColorRGB *colorRGB)
{
for (unsigned short y = 0; y < 8; ++y) {
for (unsigned short x = 0; x < 8; ++x)
{
if (font8x8_basic[code][y] & (1 << x))
Colorduino.SetPixel(7-x, y, colorRGB->r, colorRGB->g, colorRGB->b);
else
Colorduino.SetPixel(7-x, y, 0, 0, 0);
}
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javacc-maven-plugin</artifactId>
<version>2.6</version>
<dependencies>
<dependency>
<groupId>net.java.dev.javacc</groupId>
<artifactId>javacc</artifactId>
TOKEN: { "(" | ")" |
<NUM: (["0"-"9"])+> |
<ELEMENT: ( "H" | "He" | "Li" | "Be" | "B" | "C" | "N" | "O" | "F" | "Ne" |
"Na" | "Mg" | "Al" | "Si" | "P" | "S" | "Cl" | "Ar" |
"K" | "Ca" | "Sc" | "Ti" | "V" | "Cr" | "Mn" | "Fe" | "Co" | "Ni" | "Cu" | "Zn" | "Ga" | "Ge" | "As" | "Se" | "Br" | "Kr" |
"Rb" | "Sr" | "Y" | "Zr" | "Nb" | "Mo" | "Tc" | "Ru" | "Rh" | "Pd" | "Ag" | "Cd" | "In" | "Sn" | "Sb" | "Te" | "I" | "Xe" |
"Cs" | "Ba" | "Hf" | "Ta" | "W" | "Re" | "Os" | "Ir" | "Pt" | "Au" | "Hg" | "Tl" | "Pb" | "Bi" | "Po" | "At" | "Rn"
"La" | "Ce" | "Pr" | "Nd" | "Pm" | "Sm" | "Eu" | "Gd" | "Tb" | "Dy" | "Ho" | "Er" | "Tm" | "Yb" | "Lu" |
"Ac" | "Th" | "Pa" | "U" | "Np" | "Pu" | "Am" | "Cm" | "Bk" | "Cf" | "Es" | "Fm" | "Md" | "No" | "Lr")> |
<ELEMENTARYGROUP: ("OH" |
//Правило ELEMENT -> elementToken
//Находит символ химического элемента, возвращает
//соответствующий объект класса Element
ChemSubStructure Element(): {Token t;} {
t = <ELEMENT> { return new Element( t.image ); }
}
//Правило ELEMENTARYGROUP -> elementaryGroupToken
//Находит "стандартную" группу атомов (SO4, CO3, OH),
//возвращает соответствующий объект класса ElementaryGroup