Skip to content

Instantly share code, notes, and snippets.

@tarruda
tarruda / micro_events.py
Last active May 6, 2025 06:36
Micro event loop library to teach the basic concepts of python coroutines and how event loop libraries might be implemented
"""
A micro event loop library implementation from scratch.
This library provides a minimal but feature-complete asynchronous event loop
implementation for educational purposes. It demonstrates the core concepts of
asynchronous programming including:
- Task scheduling and management
- I/O multiplexing with non-blocking sockets
- Timeouts and sleep functionality
@romainl
romainl / .ctags
Last active September 8, 2024 10:26
My ctags config
--langdef=less
--langmap=less:.less
--regex-less=/^[ \t&]*#([A-Za-z0-9_-]+)/\1/i,id,ids/
--regex-less=/^[ \t&]*\.([A-Za-z0-9_-]+)/\1/c,class,classes/
--regex-less=/^[ \t]*(([A-Za-z0-9_-]+[ \t\n,]+)+)\{/\1/t,tag,tags/
--regex-less=/^[ \t]*@media\s+([A-Za-z0-9_-]+)/\1/m,media,medias/
--regex-less=/^[ \t]*(@[A-Za-z0-9_-]+):/\1/v,variable,variables/
--regex-less=/\/\/[ \t]*(FIXME|TODO)[ \t]*\:*(.*)/\1/T,Tag,Tags/
--langdef=scss
@spraints
spraints / 00-givens.cs
Last active December 14, 2015 15:59
This morning at code & coffee (http://www.meetup.com/Indianapolis-Code-and-Coffee/), we were talking about how to combine two Linq expressions together, while preserving the parse tree of both. I didn't look too hard to see if there's a built-in way to do this. If there is, I guess this was just a fun programming exercise.
// Given a class...
class Thing
{
public string Value { get; set; }
}
@sc68cal
sc68cal / cleanup.py
Last active December 12, 2015 02:38
Tarsnap archive pruner Usage: `tarsnap --list-archives | python cleanup.py | xargs -n1 tarsnap -df `
#!/usr/bin/env python
import sys
keep = {}
for line in sys.stdin.readlines():
mountpoint = line.rfind("-")
if not line[:3] + line[mountpoint:] in keep:
keep[line[:3] + line[mountpoint:]] = line
else:
@cml815
cml815 / goals2013.md
Last active December 10, 2015 04:28
Goals for 2013

Goals for 2013

Professional

  • Transition from solely a copywriter to a hybrid copy/codewriter
  • Build a search application to speed funder prospecting
  • Add more visuals to my writing products
  • Increase work income, but maintain work/life balance
  • Achieve 4 paid publications
@ryankearney
ryankearney / ComcastInject.html
Last active June 10, 2023 14:40
This is the code Comcast is injecting into its users web traffic.
<script language="JavaScript" type="text/javascript">
// Comcast Cable Communications, LLC Proprietary. Copyright 2012.
// Intended use is to display browser notifications for critical and time sensitive alerts.
var SYS_URL='/e8f6b078-0f35-11de-85c5-efc5ef23aa1f/aupm/notify.do';
// var image_url='http://servicealerts.comcast.net:8080/images/mt';
var image_url='http://xfinity.comcast.net/constantguard/BotAssistance/notice/images';
var headertext1='<strong>Comcast Courtesy Notice</strong>';
var textline1='You have reached 90% of your <b>monthly data usage allowance</b>.';
var textline2='Please sign in for more information and to remove this alert.';
var acknowledgebutton='<a href=\"#\" onClick="document.location.href=\''+SYS_URL+'?dispatch=redirect&redirectName=login&paramName=bmUid\'" title="Sign in to acknowledge" style="color: #FFFFFF;"><img alt="Sign in to acknowledge" src="'+image_url+'/mt_signin.png"/></a>';
@PhillyCDO
PhillyCDO / philly-rising-app.md
Created October 5, 2012 14:12
PhillyRising Application IDeas

#Ideas for PhillyRising Applications

A citizen engagement application (or set of applications) that connects people to the City, empowers them to get involved in their community through volunteering and attending City related events including PhillyRising events and meetings, rewards their efforts through technology and socializes their experience.

Applications should be a mobile (web or native) designed to engage citizens in efforts to improve their City. These apps would serve as resources / tools for locating facilities, learning about events occurring throughout the city, encourage participation in civic events, and connect neighbors. The engagement aspect of these applications is critical – they should link neighbors to other neighbors, and also to individuals from outside the community who are interested in engaging across the city.

The first step for any application is to map city facilities and resources, and then use the phone’s GPS to determine which are nearest to the user’s current location. P

@dcrosta
dcrosta / gist:2562350
Created April 30, 2012 20:17
A Python Mystery
Guess the output:
>>> def exec_code_object_and_return_x(codeobj, x):
... exec codeobj
... return x
...
>>> co1 = compile("""x = x + 1""", '<string>', 'exec')
>>> co2 = compile("""del x""", '<string>', 'exec')
>>> exec_code_object_and_return_x(co1, 1)
# What do you get here?
@joelverhagen
joelverhagen / README.md
Created February 12, 2012 02:14
Jekyll YouTube Embed Plugin

This is a plugin meant for Jekyll.

Example use:

Easily embed a YouTube video. Just drop this file in your _plugins directory.

{% youtube oHg5SJYRHA0 %}