Skip to content

Instantly share code, notes, and snippets.

View klovanone's full-sized avatar

Saf klovanone

  • London, UK
View GitHub Profile
@klovanone
klovanone / docker-compose.yml
Created March 30, 2023 21:02
Terraform docker image docker-compose.yaml for dev CI/CID
Version: '3.8'
services:
terraform:
image: hashicorp/terraform:1.4.2
container_name: terraform-b
volumes:
- /home/ccc/b_cloud/terraform:/workspace
working_dir: /workspace
"""
Simple example of using zmq logrecord pub
Start the client and server. A logrecord is passed to SUB which can
then be formatted / processed to any number of logging
handlers.
"""
import sys
from datetime import datetime
"""
Simple example of using zmq log handlers
This starts a number of subprocesses with PUBLRHandlers that generate
log messages at a regular interval. The main process has a SUB socket,
which aggregates and logs all of the messages to the root logger.
"""
from __future__ import print_function
import logging
import os
@klovanone
klovanone / PUBLRHandler.py
Created July 4, 2019 22:48
PubLRHandler class
class PUBLRHandler(logging.Handler):
"""A slightly more advanced logging handler that emits log messages through a PUB socket.
Differs from the standard PUBHandler in that it serializes the full python logger logrecord before sending to SUB.
Takes a PUB socket already bound to interfaces or an interface to bind to.
Example::
sock = context.socket(zmq.PUB)
sock.bind('inproc://log')
@klovanone
klovanone / analytic_wfm.py
Created December 29, 2018 17:25 — forked from sixtenbe/analytic_wfm.py
Peak detection in Python
#!/usr/bin/python2
# Copyright (C) 2016 Sixten Bergman
# License WTFPL
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law.
# You can redistribute it and/or modify it under the terms of the Do What The
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See
@klovanone
klovanone / python-dtw.py
Created December 23, 2018 08:05 — forked from socrateslee/python-dtw.py
Simple DTW(Dynamic time wrapping) in python
# -*- coding: utf-8 -*-
# An pure python implemetation of Dynamic Time Warpping
# http://en.wikipedia.org/wiki/Dynamic_time_warping
class Dtw(object):
def __init__(self, seq1, seq2, distance_func=None):
'''
seq1, seq2 are two lists,
distance_func is a function for calculating
@klovanone
klovanone / traillingProfit.js
Created December 17, 2018 23:57 — forked from anticlergygang/traillingProfit.js
If you want to get it to work, you need to npm install all of the modules required at the top and change all occurances of process.env. BINANCEAPIKEY and process.env.BINANCESECRET with your apikey and secret. After this just run 'node scalpBot.js "SYMBOL" "PERCENT_TRAIL"'
const fs = require('fs')
const https = require('https')
const colors = require('colors')
const moment = require('moment-timezone')
const querystring = require('querystring')
const util = require('util')
const crypto = require('crypto')
const percentOf = (per, num) => {
return (num / 100) * per