Skip to content

Instantly share code, notes, and snippets.

Antti Kaihola akaihola

  • Eniram Ltd
  • Espoo, Finland
Block or report user

Report or block akaihola

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
akaihola /
Last active May 31, 2018
Split a non-seekable stream into a header reader and a content reader
import io
from typing import Tuple
def tee_stream_head(stream: io.IOBase,
head_max_lines: int=3) -> Tuple[io.RawIOBase,
"""Split a stream, enable parallel reading of initial lines
This helper solves the use case where a limited number of initial lines
akaihola / btc_rallies_plot.ipynb
Last active Jan 17, 2018
Bitcoin rallies as notebook plots
View btc_rallies_plot.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
akaihola / blockstack-verification.txt
Created Nov 14, 2017
Blockstack ID verification
View blockstack-verification.txt
Verifying my Blockstack ID is secured with the address 1KXcAYCbfhV2BcRnp7xBRAy6vs97kPG4zp
An experimental extension for an IPython magic command to show object graphs.
Strongly based on tkf's code for the extension itself
and mine for turning a Python namespace into a GraphViz DOT source:
Read respective copyrights there!
View onename.io_verification.txt
Verifying that +akaihola is my Bitcoin username. You can send me #bitcoin here:
akaihola / LICENSE.txt
Last active Apr 19, 2019
XML pretty-print for ElementTree
View LICENSE.txt
Copyright (c) 2013, Antti Kaihola
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
akaihola /
Created Nov 10, 2013
Move photo from one tree to another in a git repository
import os
NEWDIR = '/home/akaihol/Kuvat_'
OLDDIR = '/media/akaihol/tasku/Valokuvat'
def get_file_fingerprint(path):
akaihola /
Created Aug 26, 2013
Recurring dynamic Celery task manager
import time
class InvalidOperation(Exception):
class RepeatingCacheManager(object):
"""Recurring dynamic Celery task manager
akaihola /
Created Apr 19, 2013
A Python script for moving a given list of files to a separate subdirectory while maintaining the directory structure.
#!/usr/bin/env python
"""Move listed files to a separate tree
cd /root/of/files
python <list-of-files.txt # only lists what will be moved
python -x <list-of-files.txt # actually moves the files
akaihola /
Created Feb 20, 2013
Salt minion bootstrap script for pristine Debian/Ubuntu virtual hosts
# Salt minion bootstrap script for freshly installed Debian/Ubuntu
# virtual servers
# Let's assume you have a newly created Debian/Ubuntu VPS with no
# network interface running. To bootstrap Salt, copy this file into
# your home directory on the [SALT MASTER] and do the following on the
# VPS:
You can’t perform that action at this time.