Skip to content

Instantly share code, notes, and snippets.

View Sean-Bradley's full-sized avatar
📰
https://sbcode.net

SBCODE Sean-Bradley

📰
https://sbcode.net
View GitHub Profile
from abc import ABCMeta, abstractmethod
class IComponent(metaclass=ABCMeta):
@staticmethod
@abstractmethod
def notify(msg):
"""The required notify method"""
@staticmethod
from abc import ABCMeta, abstractmethod
class IIterator(metaclass=ABCMeta):
@staticmethod
@abstractmethod
def has_next():
"""Returns Boolean whether at end of collection or not"""
@staticmethod
@abstractmethod
"""
Observer Design Pattern
"""
from abc import ABCMeta, abstractmethod
class IObservable(metaclass=ABCMeta):
@staticmethod
@abstractmethod
@Sean-Bradley
Sean-Bradley / client.js
Last active August 6, 2020 20:11
client.js script for the basic threejs server
import * as THREE from '/build/three.module.js';
import {OrbitControls} from '/jsm/controls/OrbitControls.js';
import Stats from '/jsm/libs/stats.module.js';
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 100);
camera.position.z = 2;
const renderer = new THREE.WebGLRenderer();
@Sean-Bradley
Sean-Bradley / index.html
Last active August 6, 2020 20:10
index.html for basic threejs server
<!DOCTYPE html>
<html>
<head>
<title>Three.js Tutorials by Sean Bradley : https://sbcode.net/threejs/</title>
<style>
body {
overflow: hidden;
margin: 0px;
}
</style>
@Sean-Bradley
Sean-Bradley / app.js
Last active August 6, 2020 20:10
Basic Threejs Server
const express = require('express')
const app = express()
const path = require('path')
app.use(express.static(__dirname + '/public'))
app.use('/build/', express.static(path.join(__dirname, 'node_modules/three/build')));
app.use('/jsm/', express.static(path.join(__dirname, 'node_modules/three/examples/jsm')));
app.listen(3000, () =>
console.log('Visit http://127.0.0.1:3000')
#Copyright 2020 Sean Bradley https://sbcode.net/grafana/ MIT License
from flask import Flask, request
import boto3
APP = Flask(__name__)
CLIENT = boto3.client(
"sns",
aws_access_key_id="your_access_key_id",
aws_secret_access_key="you_secret_access_key",
INSERT INTO `exampledb`.`flat_table_example`
(`username`,
`total`)
VALUES
('Cat',56),
('Dog',5),
('Lizard',4),
('Crocodile',2),
('Koala',50),
('Cassowary',2),
@Sean-Bradley
Sean-Bradley / gist:cf57d2dc5757d9f01261e8c4c2f0f1a8
Last active December 20, 2019 13:28
Create a simple MySQL table
CREATE TABLE `exampledb`.`flat_table_example` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(45) DEFAULT NULL,
`total` decimal(10,0) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
[Unit]
Description=Promtail service
After=network.target
[Service]
Type=simple
User=promtail
ExecStart=/usr/local/bin/promtail -config.file /usr/local/bin/config-promtail.yml
[Install]