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
from datetime import datetime | |
import fileinput, re | |
MESSAGE_REGEX = re.compile(r'(^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3}) .+ - ((New height|Imported|Opening import).+)$') | |
first_ts = 0 | |
def process(line): | |
global first_ts | |
result = MESSAGE_REGEX.match(line) |
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
from pyftdi.ftdi import Ftdi | |
from sys import argv | |
from array import array | |
import re | |
if re.fullmatch(r'[\.x]{4}', argv[1]): | |
relay_mask = sum([flag == 'x' and value or 0 for flag, value in zip(argv[1], [1, 2, 4, 8])]) | |
ftdi = Ftdi.create_from_url('ftdi:///1') | |
ftdi.set_baudrate(9600) |
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
[pretty] | |
ol = %Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset | |
[alias] | |
pp = pull -p | |
st = status --short --branch --untracked-files | |
ci = commit -S | |
br = branch | |
co = checkout | |
df = diff |
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
implicit val bdStringView = StringView.of[BigDecimal] as { _.toString } | |
def makeStringValue[T](implicit sv: StringView) = new StringValue { | |
def getString(value: AnyRef) = sv(value.asInstanceOf[T]) | |
} | |
bdStringValue = makeStringValue[BigDecimal] | |
strStringValue = makeStringValue[String] | |
qtyStringValue = makeStringValue[Long](StringView.of[Long] as { _.toString } |
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
public class Sample { | |
public static void main(String[] args) { | |
System.out.println("Hello, world!"); | |
} | |
} |