Skip to content

Instantly share code, notes, and snippets.

View jbeluch's full-sized avatar

Jonathan Beluch jbeluch

View GitHub Profile
@jbeluch
jbeluch / pagination.py
Created December 6, 2012 18:47
pagination
def paginate(self, items, endpoint, is_prev=None, is_next=None,
url_args=None, finish_args=None):
url_args = url_args or {}
finish_args = finish_args or {}
is_update = True
try:
current_page = self.request.args.get('page')[0]
except TypeError:
is_update = False
current_page = 0
@jbeluch
jbeluch / .screenrc
Created November 17, 2010 14:53
Basic .screenrc
startup_message off
hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{..G}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a"
@jbeluch
jbeluch / irssi-connect.sh
Created April 1, 2011 19:54
irssi remote notification via ssh
#!/bin/sh
# If we get an argument, use it for ssh port, otherwise use default of 22
if [ -n "$1" ]
then
port=$1
else
port=22
fi

Keybase proof

I hereby claim:

  • I am jbeluch on github.
  • I am jbeluch (https://keybase.io/jbeluch) on keybase.
  • I have a public key whose fingerprint is 72AF 6258 DBA4 81B9 63C3 0050 9791 7B4F 9DA0 4F4D

To claim this, I am signing this object:

<html>
window.top.location.href = "http://google.com";
</html>

Boulder Hack and Tell - Round 1 Summary

Thanks to all who came out to Round 1 (and especially to those who spoke)! We had four presenters (and incidentally 4 different programming languages).

Also, thanks to Viget for hosting us.

Projects

John Dennison

@jbeluch
jbeluch / iter.py
Last active December 12, 2015 05:58
class BetterIter(object):
def __init__(self, items):
self.items = items[:]
self._max_index = len(self.items) - 1
self._index = 0
def __getitem__(self, key):
try:
return self.items[key]
'''
redditmusic.resources.lib.playlists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module contains an xbmcswift2.Module for handling the playlists
interaction for the addon.
:copyright: (c) 2012 by Jonathan Beluch
:license: GPLv3, see LICENSE.txt for more details.
'''
@jbeluch
jbeluch / xbmcswift2_playlists.py
Created December 2, 2012 19:44
xbmcswift2 plugins?
''' Example usage
from xbmcswift2 import Plugin
import xbcmswift2_playlists
plugin = Plugin()
lists = xbmcswift2_playlists.Playlists(plugin)
@plugin.route('/')
#!/usr/bin/env python
'''
branches: eden, dharma, frodo-pre, eden-pre, dharma-pre, playground, master
'''
import os
import datetime
from git import Repo
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from boto.s3.bucket import Bucket