Skip to content

Instantly share code, notes, and snippets.

View csrgxtu's full-sized avatar

Archer Reilly csrgxtu

View GitHub Profile
@dabeaz
dabeaz / aproducer.py
Created October 17, 2019 17:46
"Build Your Own Async" Workshop - PyCon India - October 14, 2019 - https://www.youtube.com/watch?v=Y4Gt3Xjd7G8
# aproducer.py
#
# Async Producer-consumer problem.
# Challenge: How to implement the same functionality, but no threads.
import time
from collections import deque
import heapq
class Scheduler:
@vadviktor
vadviktor / gmail.py
Created August 30, 2012 14:29
Python: gmail unread E-mail checker
#!/usr/bin/env python
def gmail_checker(username,password):
import imaplib,re
i=imaplib.IMAP4_SSL('imap.gmail.com')
try:
i.login(username,password)
x,y=i.status('INBOX','(MESSAGES UNSEEN)')
messages=int(re.search('MESSAGES\s+(\d+)',y[0]).group(1))
unseen=int(re.search('UNSEEN\s+(\d+)',y[0]).group(1))
return (messages,unseen)
@border
border / mgoExample.go
Created August 27, 2012 15:33
mgo example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
@juehan
juehan / PyGameMP3Player.py
Created February 20, 2012 13:02
MP3Player Using PyGame
'''
Created on 2012. 2. 19.
This module is for playing mp3 (limited) and wav formatted audio file
@author: John
'''
import pygame
def playsound(soundfile):
"""Play sound through default mixer channel in blocking manner.
This will load the whole sound into memory before playback