Skip to content

Instantly share code, notes, and snippets.


Brian Thomas Smith bsmth

View GitHub Profile
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 /
Created Aug 19, 2021
Starting QDB from bin
mkdir bin_dir && cd bin_dir
tar -xvf questdb-6.0.4-no-jre-bin.tar.gz
cd questdb-6.0.4-no-jre-bin
./ start -d /path/to/my_data_dir
./ 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 /
Created Jun 29, 2021
Import CSV to QuestDB from Python
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
import time
import socket
HOST = 'localhost'
PORT = 9009
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
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 / 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

Keybase proof

I hereby claim:

  • I am bsmth on github.
  • I am bsmth ( on keybase.
  • I have a public key ASAP6sCEQqTVAtvKB6NAtD9FKDCFedfI6Cbfub88n7vVsAo

To claim this, I am signing this object:

View BG96 At Commands Telefonica Cat-M
# Descriptioon of the sequence below:
# AT+... <- AT Command sent to modem
# OK <- Modem Response
//Switch the modem to minimum functionality
// Verbose Error Reporting to get understandable error reporting (optional)
bsmth / homepage_spec.rb
Created Nov 28, 2019 — forked from gjtorikian/homepage_spec.rb
Basic Capybara testing with Jekyll + Rack
View homepage_spec.rb
require 'spec_helper'
describe "Homepage" do
before :each do
visit "/index.html"
it "has a title" do
expect(page).to have_css("h1", text: "GitHub Help")
bsmth / IncomingSNSMessage.json
Created Nov 19, 2019
Example incoming SNS message with three custom fields
View IncomingSNSMessage.json
"Records": [
"EventSource": "aws:sns",
"EventVersion": "1.0",
"EventSubscriptionArn": "arn:aws:sns:eu-west-1:489024636830:email-notifications:91018fd5-5f62-434f-9162-fd4635c5fef4",
"Sns": {
"Type": "Notification",
"MessageId": "8bd15777-93da-5f6e-8577-01335b0028ee",
"TopicArn": "",
bsmth /
Last active Nov 15, 2019
Use SES and feed variables into a pre-defined template
import csv
import json
import urllib.parse
import boto3
from botocore.exceptions import ClientError
SENDER = "EMnify Event Notifications <>"
AWS_REGION = "eu-west-1"