Skip to content

Instantly share code, notes, and snippets.

View vladaman's full-sized avatar

Vladimir Vlach vladaman

View GitHub Profile
@vladaman
vladaman / SCIDReader.java
Last active February 10, 2024 21:54
Sierra Chart SCID Format Reader in Java
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.sql.Date;
import java.util.Calendar;
public class SCIDReader {
@vladaman
vladaman / nomad.service
Last active August 17, 2023 08:25
Nomad Service Systemd
[Unit]
Description=Nomad
Documentation=https://www.nomadproject.io/docs/
Wants=network-online.target
After=network-online.target
# When using Nomad with Consul it is not necessary to start Consul first. These
# lines start Consul before Nomad as an optimization to avoid Nomad logging
# that Consul is unavailable at startup.
#Wants=consul.service
@vladaman
vladaman / activity_schema.sql
Last active June 16, 2023 13:57
Sample table structure for MySQL Activity Schema Data modeling - https://github.com/ActivitySchema
-- Table structure for table `activity_schema` for mySQL
--
CREATE TABLE `activity_schema` (
`activity_id` varchar(255) NOT NULL COMMENT 'Unique identifier for the activity record',
`ts` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'Timestamp in UTC for when the activity occurred',
`customer` varchar(255) DEFAULT NULL COMMENT 'Globally unique identifier for the customer',
`activity` varchar(255) NOT NULL COMMENT 'Name of the activity',
`anonymous_customer_id` varchar(255) DEFAULT NULL COMMENT 'Unique identifier for an anonymous customer (ex. ''segment_abfb8a'')',
`feature_1` varchar(255) DEFAULT NULL COMMENT 'Activity-specific feature 1',
@vladaman
vladaman / AmazonEventbridge.php
Created October 14, 2022 07:24
Data to AWS Eventbridge without external AWS dependency
<?php
/*
POST / HTTP/1.1
Host: events.<region>.<domain>
x-amz-Date: <Date>
Authorization: AWS4-HMAC-SHA256 Credential=<Credential>, SignedHeaders=content-type;date;host;user-agent;x-amz-date;x-amz-target;x-amzn-requestid, Signature=<Signature>
User-Agent: <UserAgentString>
Content-Type: application/x-amz-json-1.1
Content-Length: <PayloadSizeBytes>
@vladaman
vladaman / AmazonKinesis.php
Created October 14, 2022 07:20
Data to Amazon Kinesis from PHP without AWS library dependency
<?php
/*
POST / HTTP/1.1
Host: kinesis.<region>.<domain>
x-amz-Date: <Date>
Authorization: AWS4-HMAC-SHA256 Credential=<Credential>, SignedHeaders=content-type;date;host;user-agent;x-amz-date;x-amz-target;x-amzn-requestid, Signature=<Signature>
User-Agent: <UserAgentString>
Content-Type: application/x-amz-json-1.1
Content-Length: <PayloadSizeBytes>
@vladaman
vladaman / AmazonEventbridge.php
Created January 21, 2022 21:10
Simple PHP Class to send data to AWS Eventbridge
<?php
/*
POST / HTTP/1.1
Host: events.<region>.<domain>
x-amz-Date: <Date>
Authorization: AWS4-HMAC-SHA256 Credential=<Credential>, SignedHeaders=content-type;date;host;user-agent;x-amz-date;x-amz-target;x-amzn-requestid, Signature=<Signature>
User-Agent: <UserAgentString>
Content-Type: application/x-amz-json-1.1
Content-Length: <PayloadSizeBytes>
@vladaman
vladaman / bq-geohash-udf.sql
Last active July 2, 2021 02:59
Google BigQuery standardSQL UDF function to decode geohash string into bounding box and coordinates
#standardSQL
CREATE TEMPORARY FUNCTION geohashDecode(geohash STRING)
RETURNS STRUCT<bbox ARRAY<FLOAT64>, lat FLOAT64, lng FLOAT64>
LANGUAGE js AS """
if (!geohash) return null;
var base32 = '0123456789bcdefghjkmnpqrstuvwxyz';
geohash = geohash.toLowerCase();
var evenBit = true;
var latMin = -90, latMax = 90;
@vladaman
vladaman / sendMSMQ.vbs
Created August 29, 2013 09:02
Sends and Receives messages using MSMQ in vb script
Option Explicit
const MQ_SEND_ACCESS = 2
const MQ_DENY_NONE = 0
const MQ_RECEIVE_ACCESS = 1
const MQ_NO_TRANSACTION = 0
const MQ_MTS_TRANSACTION = 1
const MQ_SINGLE_MESSAGE = 3
Dim objArgs
@vladaman
vladaman / amazon-kinesis.php
Created April 8, 2014 17:28
PHP Code to request Temporary Amazon AMI Credentials and publish message dummy message to Kinesis Service
<?php
require 'aws-autoloader.php';
use Aws\Sts\StsClient;
use Aws\Kinesis\KinesisClient;
// In real applications, the following code is part of your trusted code.
// It has your security credentials that you use to obtain temporary
// security credentials.
$sts = StsClient::factory(array(
'key' => 'ACCESS-KEY-HERE',
@vladaman
vladaman / eftpos-test.js
Created April 8, 2020 13:18
EFTPOS - Protocol test connection V. 3.00 (revision:07) - https://en.wikipedia.org/wiki/EFTPOS - simple test to communicate with MyPAX S800 Terminal
var net = require('net');
var HOST = '192.168.9.111';
var PORT = 20008;
const STX = 0x02; // Start transaction
const ETX = 0x03; // End transaction
const SEP = 0x1C; // Field separator
var client = new net.Socket();