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 socket | |
import struct | |
import json | |
def unpack_varint(s): | |
d = 0 | |
for i in range(5): | |
b = ord(s.recv(1)) | |
d |= (b & 0x7F) << 7*i | |
if not b & 0x80: |
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
morseAlphabet ={ | |
"A" : ".-", | |
"B" : "-...", | |
"C" : "-.-.", | |
"D" : "-..", | |
"E" : ".", | |
"F" : "..-.", | |
"G" : "--.", | |
"H" : "....", | |
"I" : "..", |
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
# Image Effects | |
# Demonstrates some effects using different modules | |
# from the Python Imaging Library (PIL). | |
# | |
# Tip: You can touch and hold an image in the output | |
# to copy it to the clipboard or save it to your | |
# camera roll. | |
import Image, ImageOps, ImageFilter | |
from Image import BILINEAR |
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
# Example for sending an email with an attached image using smtplib | |
# | |
# IMPORTANT: You need to enter your email login in the main() function. | |
# The example is prepared for GMail, but other providers | |
# should be possible by changing the mail server. | |
import smtplib | |
from email.mime.base import MIMEBase | |
from email.mime.multipart import MIMEMultipart | |
from email import encoders |
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
# Compiling Codec 2 and FreeDV on Windows | |
# Rockwell Schrock, WW1X | |
# December 7, 2012 | |
# | |
# Based off the README.Win32 file in the FreeDV SVN repository. | |
# Tested on Windows 7 32-bit. | |
# | |
# More info: http://freedv.org/ | |
# | |
# Install MinGW with options: C Compiler, C++ Compiler, MSYS |
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
# turtle.py | |
# Basic Turtle graphics module for Pythonista | |
# | |
# When run as a script, the classic Koch snowflake is drawn as a demo. | |
# The module can also be used interactively or from other scripts: | |
# >>> from turtle import * | |
# >>> right(30) | |
# >>> forward(100) | |
# ... |
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
ply_url = 'https://pypi.python.org/packages/source/p/ply/ply-3.4.tar.gz' | |
slimit_url = 'https://pypi.python.org/packages/source/s/slimit/slimit-0.8.1.zip' | |
print 'Downloading SlimIt...' | |
from urllib import urlretrieve | |
import tarfile | |
import zipfile | |
import shutil | |
import os | |
try: |
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
# Usage of this file: | |
# This code is intended for use in the iOS python interpreter named 'Pythonista'. | |
# When looking at a page on the torrentz.eu search engine for a torrent result from Mobile Safari | |
# you can click on a bookmarklet (mentioned below) and it will cause the following: | |
# - Search results for the page are scraped | |
# - Torrent sites are visited for direct download links for the .torrent file | |
# - A .torrent file is downloaded | |
# - The .torrent file trackers are updated to include the scraped trackers listed on torrentz.eu | |
# - The .torrent file is re-uploaded to your Dropbox account (for an on-demand HTTP source) | |
# - The direct download link for the modified .torrent file is passed via RPC to a Transmission torrent server |
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 bs4, collections, console, requests, scene | |
tkColorDict = collections.OrderedDict() # key = tkinter color name | |
def loadTkColorDict(): # will automaticly be called by getColor() if needed | |
tkColorURL = 'http://www.tcl.tk/man/tcl8.6/TkCmd/colors.htm' | |
print('Loading tkinter colors from: ' + tkColorURL) | |
tkColorSoup = bs4.BeautifulSoup(requests.get(tkColorURL).text).tbody | |
print('Soup is ready. Creating color table...') | |
for tableRow in tkColorSoup.find_all('tr'): |
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
package main | |
import ( | |
"encoding/hex" | |
"log" | |
"net" | |
"time" | |
) | |
const ( |
OlderNewer