Skip to content

Instantly share code, notes, and snippets.

Avatar
😺

Brian Thomas Smith bsmth

😺
View GitHub Profile
@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:

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
AT+CFUN=0,0
OK
// Verbose Error Reporting to get understandable error reporting (optional)
@bsmth
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"
end
it "has a title" do
expect(page).to have_css("h1", text: "GitHub Help")
@bsmth
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": "arn:aws:sns:eu-west-1:.....my-email-topic",
@bsmth
bsmth / sendSESMailWithTemplate.py
Last active Nov 15, 2019
Use SES and feed variables into a pre-defined template
View sendSESMailWithTemplate.py
import csv
import json
import urllib.parse
import boto3
from botocore.exceptions import ClientError
SENDER = "EMnify Event Notifications <b.smith@emnify.com>"
RECIPIENT = "endpoint.is.online@gmail.com"
AWS_REGION = "eu-west-1"