Skip to content

Instantly share code, notes, and snippets.

View sumoward's full-sized avatar

Brian Ward sumoward

  • Cazarola Ltd
  • Dublin
View GitHub Profile
@sumoward
sumoward / 0_reuse_code.js
Created April 10, 2014 12:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@sumoward
sumoward / birthday.bas
Created April 10, 2014 14:43
HAPPY BIRTHDAY IN BASIC. Written and compiled in free basic. http://www.freebasic.net/ A little walk down memory lane.
'A SUITABLE CELBATORY SONG FOR THE BASIC BIRTHDAY PARTY AT PUBSTANDARDS DUBLIN.
'In 1964, John G. Kemeny and Thomas E. Kurtz designed the original BASIC language at Dartmouth College in New Hampshire.
DIM BDAY AS STRING
DIM BAS AS STRING
DIM I AS INTEGER
DIM Z AS INTEGER
DIM VERSES AS INTEGER
BDAY = "HAPPY BIRTHDAY TO YOU"
BAS = " DEAR BASIC!"
INPUT "HOW MANY VERSUS SHALL WE SING" ; VERSES
@sumoward
sumoward / socket test
Created May 16, 2014 10:24
socket test script for voice server
"""
This script tests the connection messages across sockets for index voice
"""
#from vocollect_lut_odr.transports import TransientSocketTransport
#import time
import socket
#from threading import Timer
#from vocollect_lut_odr.connections import LutConnection
#from vocollect_lut_odr.receivers import StringField, NumericField, Lut
#from vocollect_lut_odr.formatters import RecordFormatter
#Your optional code here
#You can import some modules or create additional functions
def checkio(data):
#Your code here
#It's main function. Don't remove this function
#It's used for auto-testing and must return a result for check.
data2=[]
for x,num in enumerate(data):
def checkio(data):
#replace this for solution
length = len(data)
data.sort()
if length%2 == 0:
return (data[int(length/2) - 1] + data[int(length/2)])/2
return data[int(length/2)]
def checkio(data):
ans = False
ucase = False
lcase= False
numeral = False
if len(data)<10:
return ans
for num in data:
if num in ('1','2','3','4','5','6','7','8','9','10'):
numeral = True
def checkio(number):
if number%3 ==0 and number %5 ==0:
return 'Fizz Buzz'
elif number%3 ==0:
return 'Fizz'
elif number%5 ==0:
return 'Buzz'
return str(number)
import subprocess
proc = subprocess.Popen("netstat",stdout=subprocess.PIPE,stderr=subprocess.PIPE)
data = proc.communicate()
print (data)
def checkio(array):
"""
sums even-indexes elements and multiply at the last
"""
length = len(array)
if length == 0:
return 0
ans = 0
for x in range(length):
def checkio(words):
counter = 0
for part in words.split():
if part.isalpha():
counter = counter +1
elif part.isdigit():
counter = 0
if counter == 3:
return True
return False