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 dataclasses import dataclass | |
from typing import Dict, List | |
import requests | |
BASE_URL = "https://ethgasstation.info/api/" | |
@dataclass | |
class GasPrice: |
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 tensorflow.keras import backend as K | |
from tensorflow.keras import constraints, initializers, regularizers | |
from tensorflow.keras.layers import Layer | |
class Attention(Layer): | |
def __init__( | |
self, | |
# step_dim, | |
kernel_regularizer=None, |
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 collections import deque | |
import numpy as np | |
class SMA: | |
def __init__(self, window: int) -> None: | |
"""Calculates a running mean and standard deviation | |
Args: | |
window (int): Window length |
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
#!/usr/bin/env ruby | |
require 'builder' | |
def to_order(str) | |
m = str.match(%r{(\d+).*/(\d+)}) | |
m[1].to_i * 1000 + m[2].to_i | |
end | |
files = Dir.glob('**/*.mp4').sort { |a, b| to_order(a) <=> to_order(b) } |
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
#!/usr/bin/env python3 | |
import json | |
import sys | |
import re | |
TYPES = { | |
'boolean': 'bool', | |
'integer': 'int', | |
'string': 'string', | |
'object': 'object', |
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
/* eslint-disable @typescript-eslint/no-explicit-any */ | |
import { AppConfig } from 'aws-sdk' | |
import { hostname } from 'os' | |
const TTL = 30 * 1000 // ms | |
export default class CachedAppConfig { | |
cache: any = {} | |
client: AppConfig | |
version: AppConfig.Version = 'null' |
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 __H_BARRIER | |
#define __H_BARRIER | |
#include <mutex> | |
// https://stackoverflow.com/questions/24465533/implementing-boostbarrier-in-c11 | |
class Barrier { | |
public: | |
explicit Barrier(std::size_t count) : mThreshold(count), mCount(count), mGeneration(0) { | |
} |
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 __RWLOCK_H | |
#define __RWLOCK_H | |
#include <pthread.h> | |
class rwlock { | |
public: | |
rwlock() { | |
pthread_rwlock_init(&lock_, nullptr); | |
} |
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
cmake_minimum_required(VERSION 3.4.1) | |
project(tensorflow-lite) | |
set(CMAKE_CXX_STANDARD 11) | |
set(SOURCES | |
allocation.cc | |
arena_planner.cc | |
c/c_api_internal.c | |
core/api/error_reporter.cc |
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
function y = db (x, SignalType) | |
if (nargin < 1) | |
print_usage (); | |
endif | |
if (nargin == 2 && SignalType == 'power') | |
m = 10; | |
else | |
m = 20; |