Skip to content

Instantly share code, notes, and snippets.

View travcunn's full-sized avatar

Travis Cunningham travcunn

View GitHub Profile

Keybase proof

I hereby claim:

  • I am travcunn on github.
  • I am travcunn (https://keybase.io/travcunn) on keybase.
  • I have a public key whose fingerprint is D8FC CD53 2D92 0048 E03C FC86 CC99 F770 8063 DE1F

To claim this, I am signing this object:

@travcunn
travcunn / connection.py
Created February 22, 2017 19:48 — forked from datakurre/connection.py
Python 3.5 async / await example with HTTP-AMQP -bridge and Nix based development environment
# -*- coding: utf-8 -*-
import aioamqp
connection = None
protocol = None
async def disconnected(exception):
global connection, protocol

Keybase proof

I hereby claim:

  • I am travcunn on github.
  • I am travcunn (https://keybase.io/travcunn) on keybase.
  • I have a public key whose fingerprint is 4656 2223 B5CB 0C6E 6F33 D504 BDDE B243 FB3C 5959

To claim this, I am signing this object:

>>> x = []
>>> y = []
>>>
>>> def test_loop():
... for _ in range(5000000):
... x.append(_)
...
>>> def test_map():
... map(y.append, range(5000000))
...
@travcunn
travcunn / SmartFileUploadTest.cs
Last active August 29, 2015 14:14
SmartFile file upload
using System;
using System.IO;
using System.Web;
using System.Net;
using System.Collections;
using SmartFile;
namespace SmartFileTest
{
@travcunn
travcunn / SmartFileCreateDirectoryTest.cs
Last active August 29, 2015 14:14
SmartFile create new directory
using System;
using System.IO;
using System.Web;
using System.Net;
using System.Collections;
using SmartFile;
namespace SmartFileTest
{

Linux simple performance tweaks

Change the I/O Scheduler

Open $ vim /etc/default/grub then add elevator=noop next to GRUB_CMDLINE_LINUX_DEFAULT. Run $ update-grub and $ cat /sys/block/sda/queue/scheduler to be sure that noop is being used:

$ vim /etc/default/grub
$ update-grub
$ cat /sys/block/sda/queue/scheduler

[noop] deadline cfq

class TrackRefs:
"""Object to track reference counts across test runs."""
def __init__(self, limit=40):
self.type2count = {}
self.type2all = {}
self.limit = limit
def update(self):
obs = sys.getobjects(0)
@travcunn
travcunn / binary_tree_search.py
Last active December 23, 2015 06:09
Binary Tree Search
class Tree(object):
def __init__(self, root_node=None):
self.root = root_node
self.__size = 0
def delete(self, value):
node = self._search(self.root, value)
if node is False:
raise ValueError("%s not found in the tree" % value)
self._delete(node)
And then it happened...
a door opened to a world...
rushing through the phone line like heroin through an addict's veins,
an electronic pulse is sent out,
a refuge from the day-to-day incompetencies is sought...
a board is found.
"This is it... this is where I belong..."
I know everyone here...
even if I've never met them,
never talked to them,