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
""" | |
Demonstrate how to test dealing with 500 Internal Server Errors, | |
e.g. when raised by calling Google Spreadsheet API | |
via https://github.com/burnash/gspread, | |
by patching the object that raises them using mock. | |
""" | |
from mock import patch | |
import gspread |
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
# Grab the names of all Graham's files | |
import os | |
import sys | |
path = '.' | |
for dir in os.listdir(path): | |
if dir[0] > sys.argv[1]: | |
for dirpath, dirnames, files in os.walk(dir): |
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 | |
import sys | |
import shutil | |
f = open("music.txt", "r") | |
dest_root = os.path.normpath('c:/Users/graham/Desktop/music') | |
src_root = os.path.normpath("d:/users/graham/music/itunes/itunes media/music/") |
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
Sub ColorMatchingCells(toMatch, color, topLeft, bottomRight) | |
' | |
' Colour in the different states in the Cumulative Flow Diagram | |
' | |
Range(topLeft, bottomRight).Select | |
'Cells.FormatConditions.Delete | |
Selection.FormatConditions.Add Type:=xlTextString, _ | |
String:=toMatch, _ | |
TextOperator:=xlContains |
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
""" | |
Join two DataFrames together | |
""" | |
import pandas as pd | |
hist_1 = [ | |
{'bucket': '0-1', 'develop': 0}, | |
{'bucket': '2-4', 'develop': 1} | |
] |
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
- hosts: localhost | |
gather_facts: False | |
sudo: no | |
tasks: | |
- name: Get my IP address | |
uri: url=http://icanhazip.com return_content=yes | |
register: ip_response | |
- name: Set my IP address |
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
// Create a tar file from a filtered tree of files | |
// e.g. a tree of Python Source files | |
project.ext { | |
pythonFiles = fileTree('src').include('**/*.py') | |
} | |
task tarPythonFiles (type: Tar) { | |
from pythonFiles // Source is our fileTree | |
includeEmptyDirs false // Otherwise we get ALL the dirs in the fileTree |
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 oauth2client.client import flow_from_clientsecrets | |
from oauth2client.file import Storage | |
from oauth2client.tools import run | |
import gdata.sites.client | |
import gdata.sites.data | |
# How to use the OAuth 2.0 client is described here: | |
# https://developers.google.com/api-client-library/python/guide/aaa_oauth | |
SCOPE = 'https://sites.google.com/feeds/' |
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
"""Adder 0.2 - Snake based language...for adding""" | |
class Snake: | |
"""The main body of the adder""" | |
skin = '>' | |
def __init__(self): | |
self.body = '' |
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
// dojo-release-1.8.3-src is installed in the same directory as this script | |
dojoConfig = { | |
baseUrl: ".", | |
packages:[{name: 'dojo', location: 'dojo'}], | |
deps:['dojo/request', 'dojo/date'] | |
}; | |
require('./dojo/dojo.js'); |
OlderNewer