Skip to content

Instantly share code, notes, and snippets.

View aolieman's full-sized avatar

Alex Olieman aolieman

View GitHub Profile
@Smephite
Smephite / quest9.md
Last active March 9, 2023 02:28
Writeup of Stellar puzzle challenge

Puzzle #9 'The clueless Multisig'

This is a writeup and example implementation for puzzle #9 by https://nebolsin.keybase.pub/puzzles/

Our clue was given in form of the pubkey GBW7N7EXR5MV4A34N7LEQGSKZMFEJGW4SQWHUPXGDX2JCGNJH2RXKHUL

When looking up the accounts state we find an threshold setting of 2/3/4, 2 active signers (and one to clawback). The master key has been removed.

The account also posseses an data entry containing

More puzzles: https://erayd.keybase.pub/puzzles.html. Have fun!

@mikedias
mikedias / script-input-format-wikipedia-rdf.groovy
Created March 11, 2016 13:53
ScritpInputFormat for wikipedia RDF format
/*
Parses the long_abstracts format:
<http://dbpedia.org/resource/Anarchism> <http://dbpedia.org/ontology/abstract> "Anarchism is a collection of movements and ideologies that ..."@en .
*/
import org.openrdf.rio.*
import org.openrdf.rio.helpers.*
def parse(line, factory) {
def reader = new StringReader(line);
@rvl
rvl / git-pushing-multiple.rst
Created February 9, 2016 11:41
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@ricardosasilva
ricardosasilva / elasticsearch_custom_backend.py
Last active August 29, 2015 14:09
Custom Haystack Elasticsearch backend with function_score and percolator support
from haystack.backends.elasticsearch_backend import ElasticsearchSearchQuery, ElasticsearchSearchBackend, \
ElasticsearchSearchEngine
from haystack.query import SearchQuerySet
from haystack.constants import DEFAULT_ALIAS, DJANGO_CT
from django.conf import settings
from haystack.utils import get_model_ct
# Snagged this a LOT of this from: https://github.com/josephdrose/django-haystack
@bbengfort
bbengfort / graph.py
Last active June 27, 2019 06:25
GraphSON is the ETL mechanism of choice for Titan graph databases using Cassandra. However, the GraphSON must be ordered correctly in order to correctly load the data using StringIO methodologies in Java. Therefore the simple construction of a Python dictionary to hold the graph data is not sufficient. This class wraps the `collections.OrderedDi…
# graph
# Python object that creates an ordered GraphSON representation.
#
# Author: Benjamin Bengfort <ben@cobrain.com>
# Created: Mon Sep 23 11:30:05 2013 -0400
#
# Copyright (C) 2013 Cobrain Company
# For license information, see LICENSE.txt
#
# ID: graph.py [] ben@cobrain.com $
@fbkarsdorp
fbkarsdorp / pml.py
Created August 29, 2013 12:47
Parsimonious Language Model in Python
#! /usr/bin/env python
import numpy as np
from heapq import nlargest
from itertools import izip
from sklearn.feature_extraction.text import CountVectorizer
old_settings = np.seterr(all='ignore')
def logsum(x):
@audreyfeldroy
audreyfeldroy / pypi-release-checklist.md
Last active February 23, 2023 15:03
My PyPI Release Checklist
  • Update HISTORY.md
  • Commit the changes:
git add HISTORY.md
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion patch
@gregburek
gregburek / rateLimitDecorator.py
Created December 7, 2011 01:51
Rate limiting function calls with Python Decorators
import time
def RateLimited(maxPerSecond):
minInterval = 1.0 / float(maxPerSecond)
def decorate(func):
lastTimeCalled = [0.0]
def rateLimitedFunction(*args,**kargs):
elapsed = time.clock() - lastTimeCalled[0]
leftToWait = minInterval - elapsed
if leftToWait>0: