Skip to content

Instantly share code, notes, and snippets.

@makoc
makoc / spam_decode.py
Created May 24, 2021 18:11 — forked from lkraider/spam_decode.py
X-OVH-SPAMCAUSE decoder
def decode(msg):
text = []
for i in range(0, len(msg), 2):
text.append(unrot(msg[i: i + 2]))
return str.join('', text)
def unrot(pair, key=ord('x')):
offset = 0
for c in 'cdefgh':
@makoc
makoc / AuthyToOtherAuthenticator.md
Created November 11, 2020 12:38 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My guess is that Brian used the

@makoc
makoc / gist:3486c45d53ccf04395179cbb1dcf47f1
Created February 11, 2019 10:57
python h5py blosc example, options explained
# conda install h5py pytables
__import__('tables') # <-- import PyTables; __import__ so that linters don't complain
import h5py
# now h5py "supports" blosc
def blosc_opts(complevel=9, complib='blosc:lz4', shuffle=True):
shuffle = 2 if shuffle == 'bit' else 1 if shuffle else 0
compressors = ['blosclz', 'lz4', 'lz4hc', 'snappy', 'zlib', 'zstd']
@makoc
makoc / vectorized_percentile.py
Created January 3, 2016 18:02 — forked from seberg/vectorized_percentile.py
Vectorized version of percentile
import numpy as np
from numpy import asarray, add, rollaxis, sort, arange
def percentile(a, q, limit=None, interpolation='linear', axis=None,
out=None, overwrite_input=False):
"""
Compute the qth percentile of the data along the specified axis.
Returns the qth percentile of the array elements.
@makoc
makoc / stride_tricks.py
Created January 3, 2016 18:01 — forked from seberg/stride_tricks.py
numy stride tricks based functions for changing the shape and axis order of arrays.
import numpy as np
from collections import defaultdict as _dd
def rolling_window(array, window=(0,), asteps=None, wsteps=None, axes=None, toend=True):
"""Create a view of `array` which for every point gives the n-dimensional
neighbourhood of size window. New dimensions are added at the end of
`array` or after the corresponding original dimension.
Parameters
----------
"""Impressive little thing how einsum + stride_tricks can beat numpys build in C functions
for correlate (for large data). (ok depending on the implementation of np.correlate, the
comparison is not fair, but still rather impressive that you can get comparable speeds)
"""
import numpy as np
import stride_tricks as st # stride_tricks.py gist
a = np.random.random((100,100,100)).ravel()
stamp = np.random.random((3,3,3)).ravel()
@makoc
makoc / rolling_window.py
Created December 11, 2015 18:53 — forked from seberg/rolling_window.py
Multidimensional rolling_window for numpy
def rolling_window(array, window=(0,), asteps=None, wsteps=None, axes=None, toend=True):
"""Create a view of `array` which for every point gives the n-dimensional
neighbourhood of size window. New dimensions are added at the end of
`array` or after the corresponding original dimension.
Parameters
----------
array : array_like
Array to which the rolling window is applied.
window : int or tuple
@makoc
makoc / keybase.md
Created October 18, 2014 00:32
Keybase proof

Keybase proof

I hereby claim:

  • I am makoc on github.
  • I am makoc (https://keybase.io/makoc) on keybase.
  • I have a public key whose fingerprint is 89F7 155E C20B F864 E29E 21DF A27F 66F7 7A73 B7EF

To claim this, I am signing this object: