Skip to content

Instantly share code, notes, and snippets.

Herminio Vazquez canimus

  • Valencia, Spain
Block or report user

Report or block canimus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@canimus
canimus / graph.html
Created Jan 8, 2020
JsGraphNetworkX
View graph.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="/static/d3.min.js"></script>
<script src="/static/vue.js"></script>
<script src="/static/jsnetworkx.js"></script>
@canimus
canimus / msgpack.js
Created Dec 20, 2019
msgpack javascript example
View msgpack.js
function readFile(stream) {
return new Promise((resolve, reject) => {
var fr = new FileReader();
fr.onload = () => {
resolve(msgpack.decode(new Uint8Array(fr.result)))
};
fr.readAsArrayBuffer(stream);
});
}
@canimus
canimus / extract_data.py
Created Dec 15, 2019
DaskDataFrame Collector Parquet
View extract_data.py
def extract_data(query_var, file_prefix):
idx = pd.date_range(start="2019-01-01", periods=13, freq="MS").strftime("%Y-%m-%d").values
dt = []
for i in range(len(idx)-1):
name = str(i+1).zfill(2)
df = pd.read_sql(query_var.format(idx[i], idx[i+1]), conn)
dt.append(df.dtypes)
df.to_parquet(f'parquet/{file_prefix}_{name}.parquet')
# Unique dataframe with all types
@canimus
canimus / status.py
Last active Dec 11, 2019
Ploting FaceGrid
View status.py
import seaborn as sns
import pandas as pd
from collections import OrderedDict
x = df[df.statusChangeBy>10].groupby([pd.Grouper(freq="W", key="statusChangedDate"), "Name"]).size().compute()
x = x.reset_index()
x.columns = ["Date", "Team", "Total"]
x = x.sort_values(by="Date")
plt.figure(figsize=(30,30))
@canimus
canimus / parquetfier.py
Created Dec 4, 2019
Parquet writer from dataframe
View parquetfier.py
import pandas as pd
import numpy as np
import pymssql
conn = pymssql.connect("localhost", "SA", "yourStrong(!)Password", "FORCE_PAPPA")
with open("task.sql") as infile:
doc_query = infile.read().strip()
time_range = list(pd.date_range(start='2019-01-01', periods=12, freq="MS").strftime("%Y-%m-%d").values)
@canimus
canimus / xmlcounter.py
Created Oct 28, 2019
XML Tag Counter with Python Multiprocess
View xmlcounter.py
# Author: Herminio Vazquez
# Date: 2019-10-28
# Project: DataStore
# @canimus
import os
from multiprocessing import Pool
import multiprocessing
import subprocess
from functional import seq
@canimus
canimus / ssh-keygen.sh
Created Sep 13, 2019
Store SSH key with previous version
View ssh-keygen.sh
ssh-keygen -p -m PEM -f ~/.ssh/id_rsa
@canimus
canimus / dna_functions.py
Last active Sep 1, 2019 — forked from vestalisvirginis/dna_functions.py
dna manipulation functions
View dna_functions.py
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'''
@canimus
canimus / recursive_tree.py
Created Jun 25, 2019
Build NetworkX Graph
View recursive_tree.py
# Navigate through xml tree and build a directed graph
def add_tree(G, node):
for n in node.getchildren():
G.add_node(n.tag)
G.add_edge(node.tag, n.tag)
add_tree(G, n)
View hdf5-alpine.docker
apk --no-cache add --virtual .builddeps.edge \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \
hdf5-dev
You can’t perform that action at this time.