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 sys | |
| def rgb_to_xy(r, g, b): | |
| X = 0.412453 * r + 0.357580 * g + 0.180423 * b | |
| Y = 0.212671 * r + 0.715160 * g + 0.072169 * b | |
| Z = 0.019334 * r + 0.119193 * g + 0.950227 * b | |
| x = X / (X+Y+Z) | |
| y = Y / (X+Y+Z) | |
| return x, y |
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 Singleton(object): | |
| """ | |
| Decorator for the singletton pattern in Python: http://stackoverflow.com/q/31875 | |
| Usage:: | |
| >>> @Singleton | |
| class MyClassSingleton(object): pass | |
| >>> instance = MyClassSingleton.instance |
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 os | |
| import re | |
| import sys | |
| import eyed3 | |
| def rename_songs(path, pattern): | |
| if not check_arguments(path, pattern): | |
| exit(1) | |
| listdir = [os.path.join(path, f) for f in os.listdir(path)] | |
| files = filter(os.path.isfile, listdir) |
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
| from Tkinter import * | |
| import urllib2 | |
| HTTP_METHODS = ["GET", "POST", "PUT", "REMOVE"] | |
| class HttpGuiApplication(Tk): | |
| def __init__(self): | |
| Tk.__init__(self) |
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
| #!/usr/bin/env python | |
| import sys | |
| import os | |
| import ftplib | |
| import socket | |
| import getpass | |
| try: | |
| input = raw_input |
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 sys | |
| import hashlib | |
| from functools import partial | |
| def md5sum(filename): | |
| with open(filename, mode="rb") as f: | |
| md5 = hashlib.md5() | |
| buf_size = md5.block_size * 64 | |
| for buf in iter(partial(f.read, buf_size), b''): |
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 pygame | |
| import time | |
| import sys | |
| def main(ogg_file, output_file): | |
| pygame.display.init() | |
| pygame.display.set_mode((100, 100)) | |
| pygame.mixer.init() | |
| pygame.mixer.music.load(ogg_file) | |
| f = open(output_file, 'w') |
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
| """ | |
| Setup for Ghostscript: | |
| Download it from http://www.ghostscript.com/ and | |
| add `/path/to/gs9.07/bin/` and `/path/to/gs9.07/lib/` to your path. | |
| """ | |
| import os | |
| import subprocess | |
| import tkinter as tk |
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
| public class HelloWorld extends Application { | |
| private Calculator calculatorService; | |
| public static void main(String[] args) { | |
| launch(args); | |
| } | |
| @Override | |
| public void start(Stage primaryStage) throws MalformedURLException { |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="http://code.jquery.com/jquery-2.1.4.min.js"></script> | |
| <style> | |
| .treeview ul { | |
| padding-left: 24px; | |
| list-style-type: none; | |
| } | |
| .treeview li > div { |
OlderNewer