This file contains 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 | |
# Copyright (C) 2006 by Johannes Zellner, <johannes@zellner.org> | |
# modified by mac@calmar.ws to fit my output needs | |
# modified by crncosta@carloscosta.org to fit my output needs | |
# Source: http://emerg3nc3.wordpress.com/2012/07/28/full-256-color-support-for-vim-andor-xterm-on-ubuntu-12-04/ | |
import sys | |
import os | |
def echo(msg): |
This file contains 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 nuke | |
import nukescripts | |
import re | |
class TriagePanel(nukescripts.PythonPanel): | |
def __init__(self): | |
nukescripts.PythonPanel.__init__(self, 'TriagePanel', 'com.ohufx.TriagePanel') | |
self.convergence = nuke.Double_Knob( 'convergence' ) | |
self.convergence.setRange( -20, 20) | |
self.LogTolin = nuke.Boolean_Knob("LogTolin/enable specifed nodes","LogTolin") |
This file contains 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
week = ['Sun', 'Mon', 'Tue', 'Wed', 'Thurs', 'Fri'] | |
print "If you break out of For else doesnt execute becuase its a part of for loop." | |
print "Enter something/ some single letter." | |
var = raw_input('>>') | |
msg = '' | |
for day in week: | |
print day | |
if day.endswith(var): | |
break | |
msg = "No day ends with %s" % var |
This file contains 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
value = None | |
try: | |
print "in try" | |
value = int(input()) | |
print "No Error Occured" | |
except: | |
print "In Except: Value: %s" % value | |
else: | |
print "In else: Value %s" % value |
This file contains 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 urllib2 | |
import os | |
import sys | |
import time | |
import threading | |
urls = ["http://broadcast.lds.org/churchmusic/MP3/1/2/nowords/271.mp3", | |
"http://s1.fans.ge/mp3/201109/08/John_Legend_So_High_Remix(fans_ge).mp3", | |
"http://megaboon.com/common/preview/track/786203.mp3"] |
This file contains 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 threading | |
import time | |
import logging | |
logging.basicConfig(level=logging.DEBUG, | |
format='(%(threadName)-10s) %(message)s', | |
) | |
def daemon(): | |
logging.debug('Starting') |
This file contains 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 PyQt4.QtCore import pyqtSignal, pyqtSlot | |
from PyQt4.QtGui import QWidget, QApplication | |
from PyQt4 import QtCore | |
import sys | |
_qObject = QtCore.QObject() | |
class SomeOtherClass(QWidget): |
This file contains 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 PyQt4.QtCore import pyqtSignal, pyqtSlot | |
from PyQt4.QtGui import QWidget, QApplication | |
import sys | |
class SomeClass(QWidget): | |
# Declare a new signal - passes Exception | |
has_error = pyqtSignal(Exception) | |
def __init__(self, parent=None): | |
super(SomeClass, self).__init__(parent) |
This file contains 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
""" | |
Find maximum memory consumed by a process specified at the command-line. | |
Usage: | |
$ python memory-usage-wait3.py cmd arg1 arg2 | |
""" | |
import os | |
import sys | |
import threading |
This file contains 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 threading | |
def f(arg): | |
global running | |
running += 1 | |
print("Spawned a thread. running=%s, arg=%s" % (running, arg)) | |
for i in range(100000): | |
pass | |
running -= 1 | |
print("Done") |
OlderNewer