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
#runs on https://trinket.io/mission-zero | |
from sense_hat import SenseHat | |
from time import sleep | |
sense = SenseHat() | |
sense.set_rotation(270) | |
#sense.show_message('Hello World',scroll_speed=0.05) | |
temp = sense.get_temperature() | |
temp = round( sense.get_temperature(), 1 ) | |
sense.show_message( str(temp) ) |
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/python | |
try: | |
from AppKit import NSWorkspace | |
except ImportError: | |
print "Can't import AppKit -- maybe you're running python from brew?" | |
print "Try running with Apple's /usr/bin/python instead." | |
exit(1) | |
from datetime import datetime |
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
sorendition "+b kG" | |
hardstatus alwayslastline "%H %-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<" | |
screen -t bash 0 | |
screen -t bash 1 | |
term screen-256color |
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: http://www.ibm.com/developerworks/aix/library/au-threadingpython/ | |
import threading, datetime | |
class ThreadClass(threading.Thread): | |
def run(self): | |
now = datetime.datetime.now() | |
# self.getName() returns the thread's identifier, e.g. "Thread-1" | |
print "%s says hello at time %s" % (self.getName(), now) |
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
class SSLSocket: | |
def setup(self): | |
# create the SSL socket | |
pass | |
def writeAndRead(self, request): | |
# send request to server | |
#... |
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
@for %%X in (.*.*) do attrib +h %%X |
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 os | |
import subprocess | |
test_cmd = 'netcat -vz 193.1.172.59 75-85' | |
expected = 'vega.ucd.ie [193.1.172.59] 80 (http) open' | |
process = subprocess.Popen(test_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
err = process.stderr.read() | |
print str(err) |
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
class Message | |
attr_accessor :from, :to, :body | |
def initialize(from, to, body) | |
@from = from | |
@to = to | |
@body = body | |
end | |
end |
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
class Table | |
attr_reader :num_diners, :table_no | |
def initialize table_no, num_diners | |
@table_no = table_no | |
@num_diners = num_diners | |
end | |
def to_string |
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
class Table | |
attr_reader :num_diners, :table_no | |
def initialize table_no, num_diners | |
@table_no = table_no | |
@num_diners = num_diners | |
end | |
def to_string |
NewerOlder