Skip to content

Instantly share code, notes, and snippets.

View JohnAllen's full-sized avatar

John Allen JohnAllen

View GitHub Profile
@JohnAllen
JohnAllen / main.rs
Created March 14, 2024 08:56 — forked from chrishulbert/main.rs
Interactive Brokers TWS API in Rust
// MIT licensed.
use std::net::TcpStream;
use std::io::{Read, Write};
use std::sync::mpsc::channel;
use std::thread;
fn main() {
let mut stream = TcpStream::connect("127.0.0.1:7496").expect("connect");
stream.set_nodelay(true).expect("nodelay"); // Because we're wannabe HFT traders.
package main
import (
"os"
"os/signal"
polygonws "github.com/polygon-io/client-go/websocket"
"github.com/polygon-io/client-go/websocket/models"
"github.com/sirupsen/logrus"
)
#install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
sudo apt update
sudo apt install git
@JohnAllen
JohnAllen / install_go_1.19.sh
Last active February 12, 2023 10:28
install Go for Linux
wget https://go.dev/dl/go1.19.linux-amd64.tar.gz
sudo tar -xvf go1.19.linux-amd64.tar.gz
sudo mv go /usr/local/go
export GOROOT=/usr/local/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
echo "GOROOT=/usr/local/go " >> ~/.bashrc
echo "PATH=$GOPATH/bin:$GOROOT/bin:$PATH" >> ~/.bashrc
type SymbolMapping struct {
IBSymbol string
FirstRateSymbol string
TickDataSymbol string
Name string
}
var SymbolMappings = []SymbolMapping{
{IBSymbol: "ES", FirstRateSymbol: "ES", TickDataSymbol: "ES", Name: "S&P 500"},
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
const admin = require("firebase-admin") // required
const projectId = "lingo-e9b0f"
admin.initializeApp({ projectId })
const db = admin.firestore()
async function getMarker() {
let count = 0;
const snapshot = await admin.firestore().collection('sentence-pairs').get()
const stringSimilarity = require("string-similarity");
const arrayOfLangNames = Object.values(languages)
function getLangCodeFromLanguage(languageName) {
let code = Object.keys(languages).find(key =>
languages[key] === languageName
)
if (!code) {
const csv = require('csvtojson')
const fs = require('fs')
const csvFilePath='sentences.csv'
const csvWritePath='sentences.json'
const readStream= fs.createReadStream(csvFilePath);
const writeStream = fs.createWriteStream(csvWritePath)
// This writes JSON but incorrectly. You will see. Look at the options for this CSV library
import numpy as np
import os
import shutil
from PIL import Image
from tensorboardX import SummaryWriter
INFECTED = 'infected'
UNINFECTED = 'uninfected'
train_dir = 'dataset/train_signs'
X_train = os.listdir(train_dir)