Skip to content

Instantly share code, notes, and snippets.

View canimus's full-sized avatar

Herminio Vazquez canimus

View GitHub Profile
@canimus
canimus / TreasuryPricing.py
Created December 17, 2021 01:00 — forked from RamonWill/TreasuryPricing.py
How to convert a Treasury price to decimal in python and vice versa
# Convert Treasury price to decimal in python
# calculating US treasury pricing in python
def treasury_to_decimal(price):
"""
Converts a treasury priced in 32nds into a decimal. This works for
treasurys priced up to 3dp i.e. "99-126"
"""
price_split = price.split("-")
integer_part = int(price_split[0])
@canimus
canimus / AWS Swarm cluster.md
Created March 29, 2021 23:35 — forked from ghoranyi/AWS Swarm cluster.md
Create a Docker 1.12 Swarm cluster on AWS

This gist will drive you through creating a Docker 1.12 Swarm cluster (with Swarm mode) on AWS infrastructure.

Prerequisites

You need a few things already prepared in order to get started. You need at least Docker 1.12 set up. I was using the stable version of Docker for mac for preparing this guide.

$ docker --version
Docker version 1.12.0, build 8eab29e

You also need Docker machine installed.

@canimus
canimus / dna_functions.py
Last active September 1, 2019 10:37 — forked from vestalisvirginis/dna_functions.py
dna manipulation functions
from functional import seq # PyFunctional
from itertools import product
def all_kmers(k):
'''return list of all dna carthesien products of length k'''
all = list(product('ACGT', repeat=k))
return seq(all).map(lambda x: ''.join(x)).to_list()
def kmer_per_segment(dna_segment, k):
'''return all the dna substrings of length k of the different dna strings in dna list'''
# Pull the necessary images:
docker pull nathanleclaire/curl:latest
docker pull openjdk:8u111-jre-alpine

# Start the controller container, note that it has RW access to the Docker API socket:
docker run \
  -ti \
  --rm \
@canimus
canimus / logstash.conf
Created April 9, 2018 14:27 — forked from robinsmidsrod/logstash.conf
Logging Windows event log information to Logstash using nxlog and JSON transport
input {
tcp {
type => "syslog"
host => "127.0.0.1"
port => 3514
}
tcp {
type => "eventlog"
host => "10.1.1.2"
port => 3515
@canimus
canimus / xpub-xsub.js
Created June 25, 2017 12:24 — forked from tjanczuk/xpub-xsub.js
How to connect 5 publishers with 5 subscribers over TCP using ZeroMQ's XPUB/XSUB proxy
// How to connect 5 publishers with 5 subscribers
// over TCP using ZeroMQ's XPUB/XSUB proxy.
// sub (connect)
// <-8701->
// (bind) xpub <---> xsub (bind)
// <-8700->
// (connect) pub
var zmq = require('zmq');
@canimus
canimus / README.md
Created April 12, 2017 06:06 — forked from oodavid/README.md
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

@canimus
canimus / test-genesis.json
Last active February 1, 2018 16:57 — forked from frozeman/test-genesis.json
Test genesis block
{
"config": {
"chainId": 88888,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x1",
"extraData" : "0x00",
@canimus
canimus / Test.java
Created December 31, 2016 00:55 — forked from klepikov/Test.java
Demo code for the GTAC 2013 talk "Web Performance Testing with WebDriver" by Michael Klepikov
import java.io.IOException;
import java.net.URL;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import org.json.*;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.*;
import org.openqa.selenium.logging.*;

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: