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
akaihola / tee_stream_head.py
Last active May 31, 2018
Split a non-seekable stream into a header reader and a content reader
View tee_stream_head.py
import io
from typing import Tuple
def tee_stream_head(stream: io.IOBase,
head_max_lines: int=3) -> Tuple[io.RawIOBase,
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
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
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 https://explorer.blockstack.org/address/1KXcAYCbfhV2BcRnp7xBRAy6vs97kPG4zp
View ipython_object_graphs.py
"""
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:
- https://github.com/tkf/ipython-hierarchymagic
- http://pypi.python.org/pypi/pyrels/0.1.1
Read respective copyrights there!
View onename.io_verification.txt
Verifying that +akaihola is my Bitcoin username. You can send me #bitcoin here: https://onename.io/akaihola
@akaihola
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
akaihola / movephotos.py
Created Nov 10, 2013
Move photo from one tree to another in a git repository
View movephotos.py
#!/usr/bin/python3.3
import os
NEWDIR = '/home/akaihol/Kuvat_'
OLDDIR = '/media/akaihol/tasku/Valokuvat'
def get_file_fingerprint(path):
@akaihola
akaihola / repeating_cache_manager.py
Created Aug 26, 2013
Recurring dynamic Celery task manager
View repeating_cache_manager.py
import time
class InvalidOperation(Exception):
pass
class RepeatingCacheManager(object):
"""Recurring dynamic Celery task manager
@akaihola
akaihola / mover.py
Created Apr 19, 2013
A Python script for moving a given list of files to a separate subdirectory while maintaining the directory structure.
View mover.py
#!/usr/bin/env python
"""Move listed files to a separate tree
Usage::
cd /root/of/files
python mover.py <list-of-files.txt # only lists what will be moved
python mover.py -x <list-of-files.txt # actually moves the files
@akaihola
akaihola / salt-bootstrap.sh
Created Feb 20, 2013
Salt minion bootstrap script for pristine Debian/Ubuntu virtual hosts
View salt-bootstrap.sh
#!/bin/bash
# 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.