Skip to content

Instantly share code, notes, and snippets.

View drvinceknight's full-sized avatar
😀
👍

Vince Knight drvinceknight

😀
👍
View GitHub Profile
#!/bin/sh
tmux new-session -d # Create a new session
tmux split-window -v -p 25 # Create a horizontal split (25 % of the screen)
tmux split-window -h # Create a vertical split
tmux selectp -t 1 # Go to top pane
tmux -2 attach-session -d # Attach
import random
deck = ['1S','2S','3S','4S', '1H', '2H', '3H', '4H']
p1 = []
p2 = []
random.shuffle(deck)
while len(deck) > 0:
p1.append(deck.pop())
p2.append(deck.pop())
cost_of_items = {'apple': 4,
'cake': 6,
'doughnut': 12}
class ShoppingBasket:
"""
A class for a shopping basket with attributes for the cost and the contents of a shopping basket
"""
def __init__(self):
self.cost = 0 # Initialising a cost of 0 (basically the value of the basket when someone picks it up
import random
def utility(s1, s2):
if s1 == s2 == 'B':
return 4,4
if s1 == s2 == 'C':
return 2,2
if s1 == 'C' and s2 == 'B':
return 5,0
return 0,5
from __future__ import division
import random
from csv import reader
class Player:
"""
A class for a player
"""
def __init__(self, name):
self.name = name
$ jekyll new site_for_tests
from selenium import webdriver
browser = webdriver.Firefox() # Open the browser
browser.get('http://0.0.0.0:4000/') # Go to the address of the jekyll server
assert 'Your awesome title' in browser.title # This checks that the required title is in browser title
from selenium import webdriver
browser = webdriver.Firefox() # Open the browser
browser.get('http://0.0.0.0:4000/') # Go to the address of the jekyll server
assert 'How to write tests' in browser.title # This checks that the required title is in browser title
# Site settings
title: How to write tests
email: [email protected]
description: > # this means to ignore newlines until "baseurl:"
Write an awesome description for your new site here. You can edit this
line in _config.yml. It will appear in your document head meta (for
Google search results) and in your feed.xml site description.
baseurl: "" # the subpath of your site, e.g. /blog/
url: "http://yourdomain.com" # the base hostname & protocol for your site
twitter_username: jekyllrb
from selenium import webdriver
from itertools import izip
import unittest
import yaml
class VisitorTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(3)