Skip to content

Instantly share code, notes, and snippets.

View geekodour's full-sized avatar
🐧
who are you and why are you here. tell me.

Hrishikesh Barman geekodour

🐧
who are you and why are you here. tell me.
View GitHub Profile
@defunkt
defunkt / clients.md
Created April 18, 2010 14:09
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

@mislav
mislav / pagination.md
Created October 12, 2010 17:20
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o

@maxcountryman
maxcountryman / caesar.py
Created November 8, 2010 20:58
Extremely simple Caesar cipher
import argparse
parser = argparse.ArgumentParser(description='Shift a string n chars based on step.')
parser.add_argument('--shift', help='shift a string of text')
parser.add_argument('--deshift', help='deshift a string of text')
parser.add_argument('--steps', type=int)
args = parser.parse_args()
steps = args.steps
@maxcountryman
maxcountryman / kaa.py
Created November 15, 2010 01:35
A very simple non-blocking IRC bot using gevent
import gevent
from gevent import socket, queue
from gevent.ssl import wrap_socket
import logging
logger = logging.getLogger('irc')
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
@dpritchett
dpritchett / search_fatwallet.py
Created November 17, 2010 22:07
Use this as a cron job maybe?
import feedparser, re #feedparser available at http://feedparser.org/
def search_fatwallet(keyword):
fw = feedparser.parse(r'http://feeds.feedburner.com/FatwalletHotDeals')
for entry in fw.entries:
if re.search(keyword, entry['title']):
print entry['title'], '\n', entry['feedburner_origlink']
print ''
"""
>>> search_fatwallet('car')
@eykd
eykd / python_evolution.py
Created January 20, 2011 21:18
Profiling the factorial implementations at http://metaleks.net/programming/the-evolution-of-a-python-programmer/comment-page-1 with results for factorial(10) run 100,000 times.
# -*- coding: utf-8 -*-
"""Profiling The Evolution of the Python Programmer
Based on the code offered in good humor at
<http://metaleks.net/programming/the-evolution-of-a-python-programmer>.
I thought it would be fun to profile the various approaches to a
factorial implementation offered by Aleks. My attempt below.
I couldn't profile the EXPERT PROGRAMMERS or the Unix Programmer, as I
RFC 0001 - Host Software
RFC 0002 - Host software
RFC 0003 - Documentation conventions
RFC 0004 - Network timetable
RFC 0005 - Decode Encode Language (DEL)
RFC 0006 - Conversation with Bob Kahn
RFC 0007 - Host-IMP interface
RFC 0008 - ARPA Network Functional Specifications
RFC 0009 - Host Software
RFC 0010 - Documentation conventions
@jehiah
jehiah / simple_args_parsing.sh
Created March 4, 2011 16:56
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@didip
didip / request_handler_test.py
Created March 12, 2011 21:46
Testing Tornado RequestHandlers
import unittest, os, os.path, sys, urllib
import tornado.database
import tornado.options
from tornado.options import options
from tornado.testing import AsyncHTTPTestCase
# add application root to sys.path
APP_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(os.path.join(APP_ROOT, '..'))
@hgmnz
hgmnz / query_planner.markdown
Created March 23, 2011 14:14
PostgreSQL query plan and SQL performance notes

Types of index scans

Indexes

Sequential Scan:

  • Read every row in the table
  • No reading of index. Reading from indexes is also expensive.