Skip to content

Instantly share code, notes, and snippets.

David Pennington Xeoncross

View GitHub Profile
View gist:cdb501a44eacda865b00b4806dcb318a
package main
import (
Xeoncross / 64bit_hash_collisions_test.go
Last active Jun 3, 2020
Tests to see how 64bit hash functions perform in Go.
View 64bit_hash_collisions_test.go
package main
import (
Xeoncross /
Created May 22, 2020 — forked from vgoklani/
Latent Semantic Analysis (LSA) [simple example]
# reference =>
from numpy import zeros
from scipy.linalg import svd
from math import log # needed for TFIDF
from numpy import asarray, sum
titles = ["The Neatest Little Guide to Stock Market Investing",
Xeoncross / crypto_news.json
Created May 22, 2020 — forked from stungeye/crypto_news.json
News Site RSS Feeds
View crypto_news.json
"url": "",
"rss": ""
"url": "",
"rss": ""
Xeoncross /
Last active May 7, 2020
Example database class for wrapping mysql-connector for python
import mysql.connector
# from mysql.connector import Error
# pip3 install mysql-connector
class DB():
def __init__(self, config):
self.connection = None
self.connection = mysql.connector.connect(**config)
Xeoncross /
Created Apr 30, 2020
Be careful when setting docker compose environment variables

The following shows the right and wrong way to specify the environment flags. Be careful using Key: Value format depending on the docker version.

version: "3.2"
        image: mariadb:10.5
            - "3306:3306"
Xeoncross / mysql_bitmap.sql
Created Apr 8, 2020
MySQL / MariaDB bitmap operations on records
View mysql_bitmap.sql
create table test(id int, b blob);
insert into test(id, b) select 1, 0x000000;
insert into test(id, b) select 2, 0xffffff;
delimiter //
create function set_bit(b blob, pos int, val int) returns blob reads sql data
comment 'changes the bit at position <pos> (0: right most bit) to <val> in the blob <b>'
Xeoncross / interruptcontext.go
Created Feb 18, 2020
Example of using os.Signal interrupts (or CTRL+C) to stop context which can be used to end a process, database query, or http server.
View interruptcontext.go
func InterruptContext() context.Context {
quit := make(chan os.Signal, 1)
signal.Notify(quit, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
ctx, cancel := context.WithCancel(context.Background())
go func() {
View context_middleware.go
package contextmiddleware
import (
Xeoncross /
Created Feb 12, 2020
Amazon AWS Aurora Serverless - Summary

I have a pretty constant-use case in mind for collecting client metrics with different loads and spikes throughout the day and am mostly interested in paying a little extra to not have to manage the RDS/Aurora server instances. I basically just need a k/v store but need to do report queries/scans so DynamoDB isn’t a good fit. (COUNT(*) FROM, SUM, etc..)

Slow start

Looks like a minimum of 5 minutes of usage each time the database is activated and I’m pretty sure my load will never let the database shutdown so that might solve the cold-start issue.

You can’t perform that action at this time.