This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Sorting nodes of a graph according to their degrees | |
Idea from: http://mail.python.org/pipermail/python-list/2002-July/152876.html | |
""" | |
#example adjacency list | |
adjlist = {'a':['b','c','d'],'b':['a','d'],'c':['a'],'d':['b','a']} | |
histogram = [ (len(value), key) for key, value in adjlist.iteritems() ] | |
histogram.sort() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This script writes the VDSO to the file linux-gate.dso.1 . | |
Use `objdump -d linux-gate.dso.1` to examine it. | |
You might also want to play around more with the other objdump options and | |
the readelf tool :) | |
LICENSE: MIT License ( http://www.opensource.org/licenses/mit-license.php ) | |
""" | |
from __future__ import with_statement | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class QueueDeliveryMailer < ActionMailer::Base | |
self.delivery_method = Rails.application.config.mail_queue_outbound_delivery_method #remember this from development.rb | |
layout nil | |
def rebuild_mail(id) | |
mail({:from => $redis.get("mail:#{id}:sender_address"), | |
:to => $redis.get("mail:#{id}:recipient_address"), | |
:reply_to => $redis.get("mail:#{id}:reply_to_address"), | |
:mime_version => $redis.get("mail:#{id}:mime_version"), | |
:content_type => $redis.get("mail:#{id}:content_type"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import websockets | |
import asyncio | |
import json | |
import async_timeout | |
import sys | |
async def consumer_contract(retries_before_quitting=10): | |
counter = 0 | |
async with websockets.connect(sys.argv[1]) as ws: |