Skip to content

Instantly share code, notes, and snippets.

View wrunk's full-sized avatar

Warren Runk wrunk

View GitHub Profile
def my_thread_func(comment_id):
# form url based on comment id so http://www.evite.com/services/<comment_id>/whatever
# send request
# check result, log error
from multiprocessing.pool import ThreadPool as Pool
def main():
# Read file into a list of IDs
list_of_ids = [read from file]
#!/usr/bin/env python
# This script is free software written by Warren Runk (warren.runk@gmail.com)
"""
This is a (hopefully) simple example of how to download your appengine logs to a normal
linux (non google or appengine) computer using remote api and logservice.
You can use appcfg.py to "request_logs" but that is not practical for real workloads
From here you can download smaller time slices of logs as necessary depending on your scale.
@wrunk
wrunk / guid_python.py
Last active August 29, 2015 14:09
Creating GUIDs in python using the first two chars to get a shard
#!/usr/bin/env python
# Written by Warren Runk
# This file is free software in the public domain.
import base64
import uuid
@wrunk
wrunk / sharded_guid.py
Last active August 29, 2015 14:09
Sharded globally unique identifier mini library for python2.7
#!/usr/bin/env python
# Written by Warren Runk
# This file is free software in the public domain.
import base64
import random
import uuid
@wrunk
wrunk / bash_profile
Created March 16, 2015 21:32
Some of my bashrc/profile settings
#!/bin/bash
# --------------------------------------------------------------------------- #
# These are git settings from:
# http://neverstopbuilding.net/gitpro/
# --------------------------------------------------------------------------- #
#source ~/.git-completion.bash
#source ~/.git-prompt.sh
#
# Settings for python virtual envs and the python virtualenvwrapper
@wrunk
wrunk / simple_nudge.py
Created May 31, 2011 18:29
Simple Nudge app using Eventlet. Good starting point for a webapp.
#!/usr/bin/env python
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@wrunk
wrunk / simple.py
Created June 24, 2011 18:32
Simple python script for bustin
#!/usr/bin/env python
# The above line will cause this script to be run using the program 'python'
# Lines that start with a hash are comments for fun
# The interpreter wont read these.
def print_function():
print '''
******* * *
* * *
@wrunk
wrunk / path.py
Created October 28, 2011 00:18
Get current python file path
#!/usr/bin/env python
# Stupid gist by warren runk
import os
if __name__ == "__main__":
full_file_path = os.path.realpath(__file__)
print 'Full path to this current file is', full_file_path
@wrunk
wrunk / opt_parse.py
Created December 22, 2011 00:29
Python option parse example (optparse OptionParser)
from optparse import OptionParser
import sys
def example_function():
print "Hello world!"
if __name__ == "__main__":
parser = OptionParser()
parser.add_option(
@wrunk
wrunk / del_files_older_than.py
Created December 22, 2011 02:14
Python clean files from a directory
'''
Pass a time in seconds, and a base directory.
I will nuke anything older than now - seconds in that directory. Optionally
recursively
'''
from datetime import datetime
import os
from optparse import OptionParser