Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Brian Thomas Smith bsmth

👋
View GitHub Profile
@bsmth
bsmth / cspell.json
Last active Jan 2, 2023
Testing .vscode/cspell.json
View cspell.json
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"language": "en",
"languageId": "*",
"dictionaries": [
"bash",
"css",
"cpp",
"django",
@bsmth
bsmth / transform-css.html
Last active Dec 28, 2022
Using 'transform-style' with 2d elements
View transform-css.html
<!DOCTYPE html>
<html>
<style>
.wrapper {
transform-style: preserve-3d;
}
.wrapper2 {
transform-style: flat;
}
@bsmth
bsmth / indexeddb.js
Last active Oct 20, 2022
Updating IndexedDB objectstore item by key
View indexeddb.js
const customerData = [
{ ssn: "444-44-4444", name: "Bill", age: 35, email: "bill@company.com" },
{ ssn: "555-55-5555", name: "Donna", age: 32, email: "donna@home.org" },
];
const dbName = "my_database";
const request = indexedDB.open(dbName, 2);
request.onerror = (event) => {
console.log(event);
@bsmth
bsmth / install_node_19.sh
Created Oct 20, 2022
Installing node 19 with global modules from 18
View install_node_19.sh
# Using 19
node -v
v19.0.0
yarn && yarn start
zsh: command not found: yarn
# of course, everything is broken
# try reinstall 19 with all of the global modules from 18
nvm install 19 --reinstall-packages-from=18
@bsmth
bsmth / .zshrc
Created Aug 16, 2022 — forked from zanshin/.zshrc
My .zshrc file (from Mark Nichols -> @zanshin)
View .zshrc
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
#export ZSH_THEME="robbyrussell"
export ZSH_THEME="zanshin"
@bsmth
bsmth / qdb.sh
Created Aug 19, 2021
Starting QDB from bin
View qdb.sh
mkdir bin_dir && cd bin_dir
wget https://github.com/questdb/questdb/releases/download/6.0.4/questdb-6.0.4-no-jre-bin.tar.gz
tar -xvf questdb-6.0.4-no-jre-bin.tar.gz
cd questdb-6.0.4-no-jre-bin
./questdb.sh start -d /path/to/my_data_dir
./questdb.sh stop
# /path/to/my_data_dir will create a new root directory for QuestDB
# If a server config file exists already, it will be loaded, i.e.
@bsmth
bsmth / import.py
Created Jun 29, 2021
Import CSV to QuestDB from Python
View import.py
import urllib.request
import pandas as pd
import requests
def import_data(file_name, table_name):
params = {}
params['timestamp'] = 'TradeDate'
params['partitionBy'] = 'MONTH'
url_values = urllib.parse.urlencode(params)
query_url = "http://%s:9000/imp?" % (server_ip) + url_values
View ilp.py
import time
import socket
HOST = 'localhost'
PORT = 9009
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
sock.connect((HOST, PORT))
sock.sendall(('eod,instrument=fut open=141.5,high=142.0,low=139.9,close=142.0,settle_price=143.7,value=42.27\n').encode())
@bsmth
bsmth / averages.sql
Last active Apr 16, 2021
Joins weekly averages with prev compared to current week
View averages.sql
create table user_stats
(
ts timestamp,
username symbol,
name symbol,
ip_address symbol,
post_count int
)
timestamp(ts);
View keybase.md

Keybase proof

I hereby claim:

  • I am bsmth on github.
  • I am bsmth (https://keybase.io/bsmth) on keybase.
  • I have a public key ASAP6sCEQqTVAtvKB6NAtD9FKDCFedfI6Cbfub88n7vVsAo

To claim this, I am signing this object: