Skip to content

Instantly share code, notes, and snippets.

View mycroft's full-sized avatar
👋
Looking for a job!

Patrick MARIE mycroft

👋
Looking for a job!
View GitHub Profile
import re
import time
class Stage(object):
"""One of the element of a retention policy.
A stage means "keep that many points with that precision".
Precision is the amount of time a point covers, measured in seconds.
@mycroft
mycroft / encrypt.c
Created January 25, 2020 13:10
Encrypt & decrypt with Openssl
#include <openssl/conf.h>
#include <openssl/evp.h>
#include <openssl/err.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
@mycroft
mycroft / connect.c
Created January 25, 2020 13:08
A C TCP connect with TCP_NODELAY & TCP_QUICKACK options
#include <errno.h>
#include <linux/tcp.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>
@mycroft
mycroft / gist:3accaf2a2e3ea325f670707b3ea4605d
Created April 11, 2018 20:38
Recovering BCH from ninki wallet.
#!/bin/sh
# You need to retrieve the hot, the cold and ninki pub using the
# patch script you'll find on https://github.com/mycroft/ninki-recover
# Fill the inputs, start sweeping, open console, and you'll see outputs like the
# following:
# used path is: m/0/1000/00
# balance is 0 on this key:
# address: 32aVrFpfoACPiGFJiLUfkNnbkBoWnGu1Sp
# hot (priv): L42FdtAvqUkPNNAbFp7YFc8pbs1TaLQorAPi8vSwWGvaFrbRrxdr
@mycroft
mycroft / sh
Last active January 24, 2018 15:38
Building mplayer 1.3.0 on fedora workstation 27
#!/bin/sh
make distclean
./configure --prefix=/opt/mplayer --enable-termcap --enable-iconv --enable-langinfo --enable-networking \
--enable-smb --enable-cdparanoia --enable-cddb --enable-freetype --enable-fontconfig --enable-unrarexec \
--enable-inet6 --enable-ftp --enable-pthreads --enable-gnutls --enable-gif --enable-png --enable-mng --enable-libcdio \
--enable-xanim --enable-xvid-lavc --enable-speex --enable-musepack \
--enable-x264 --enable-x264-lavc --enable-liba52 --enable-xinerama --enable-alsa --enable-pulse \
--enable-xvid --enable-libvorbis --enable-jpeg --enable-faad --enable-faac \
--enable-libmpeg2 --enable-mpg123 --enable-caca --enable-aa --enable-vdpau --enable-libdca --enable-theora \
### Keybase proof
I hereby claim:
* I am mycroft on github.
* I am mycroft (https://keybase.io/mycroft) on keybase.
* I have a public key whose fingerprint is 6285 5941 1156 F08C C635 1E1D 617A 5AE6 7694 51E2
To claim this, I am signing this object:
@mycroft
mycroft / gist:5546167
Created May 9, 2013 08:03
Screenshots (and light reports) by Selenium when using Behat and Mink; Only supported by Selenium2/Webdriver
<?php
use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Context\BehatContext,
Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode;
use Behat\Behat\Event\StepEvent;
@mycroft
mycroft / git-setup.sh
Created September 22, 2012 15:21
Git setup niceties
# via https://gist.github.com/419201#file_gitconfig.bash
# Install (from Matt's gist) these useful Git aliases & configurations with the following command:
# $ bash <(curl -s https://raw.github.com/gist/419201/gitconfig.bash)
git config --global color.ui auto # colorize output (Git 1.5.5 or later)
git config --global color.interactive auto # and from 1.5.4 onwards, this will works:
echo "Set your name & email to be added to your commits."
echo -n "Please enter your name: "