Skip to content

Instantly share code, notes, and snippets.

View ozkatz's full-sized avatar

Oz Katz ozkatz

View GitHub Profile
@ozkatz
ozkatz / lakefs_resolver.py
Created February 19, 2021 18:20
lakeFS python resolver (returns S3 addresses for objects under a prefix)
#!/usr/bin/env python
from urllib.parse import urlparse
from typing import Iterator
from bravado.requests_client import RequestsClient
from bravado.client import SwaggerClient
class lakeFSResolver(object):
"""
An example lakeFS client that allows resolving
@ozkatz
ozkatz / cla.txt
Created August 2, 2020 15:55
lakeFS CLA
lakeFS Individual Contributor License Agreement
Adapted from http://www.apache.org/licenses/ © Apache Software Foundation
Thank you for your interest in lakeFS (the "Foundation"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Foundation must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the Foundation and its users; it does not change your rights to use your own Contributions for any other purpose. If you have not already done so, please complete and sign, then scan and email a pdf file of this Agreement to [email protected]
Please read this document carefully before signing and keep a copy for your records.
You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the Foundation. In return, the Foundation
### Keybase proof
I hereby claim:
* I am ozkatz on github.
* I am ozk (https://keybase.io/ozk) on keybase.
* I have a public key whose fingerprint is 1AB0 E63A 96C0 217D 04EB 70A7 71DF 2351 5439 C3A1
To claim this, I am signing this object:
import urllib2
import multiprocessing
import sqlite3
# With this line in place, calling urlopen() below
# will simply hang on OSX 10.9.1 (Python 2.7.5)
# comment the line out and urlopen() works as it should.
c = sqlite3.connect('/tmp/some.db')
# Add this to your fabfile.py (or import it from there)
from boto.ec2.connection import EC2Connection
class EC2Resolver(object):
AWS_KEY_ID = 'xxxxxxx'
AWS_SECRET_ACCESS_KEY = 'xxxxxx' # Alternitavely take this info from environment variables or some other resource.
def __init__(self):
@ozkatz
ozkatz / ec2_ssh_config.py
Created June 21, 2013 00:50
generate an ~/.ssh/config file from your EC2 instances, so that you'd never have to lookup those fugly ec2-xx-xx-xx-xxx.compute-1.amazonaws.com hostnames again. Use your instance name instead!
#!/usr/bin/env python
import os
import sys
import argparse
try:
from boto.ec2.connection import EC2Connection
except ImportError:
sys.stderr.write('Please install boto ( http://docs.pythonboto.org/en/latest/getting_started.html )\n')
sys.exit(1)
@ozkatz
ozkatz / bogosort.py
Created May 26, 2013 09:30
A bogosort implementation in Python. For all your big data needs.
from random import shuffle
def is_ordered(l):
for i, x in enumerate(l):
if i == 0:
continue
if x < l[i - 1]:
return False
return True
@ozkatz
ozkatz / gist:5520308
Last active April 14, 2020 20:03
A wrapper around Django's EmailMultiAlternatives that renders templates.
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template.loader import render_to_string
class EMail(object):
"""
A wrapper around Django's EmailMultiAlternatives
that renders txt and html templates.
Example Usage:
@ozkatz
ozkatz / 99bottles
Created November 26, 2011 01:08 — forked from gsiegman/99bottles
99 Bottles of Beer on the Wall (as a one liner. I don't know why.)
import os; [ os.system('say %d bottles of beer on the wall, %d bottles of beer, if one of those bottles should happen to fall, %s bottles of beer on the wall' % (99 - i, 99 - i , 99 - i - 1)) for i in range(0, 99) ]