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
const puppeteer = require('puppeteer'); | |
let _browser; | |
let _page; | |
async function please_wait() { | |
console.log('you wait') | |
let you_wait = new Promise((resolve, reject) => { | |
setTimeout( function() { | |
console.log('time passes'); |
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
""" | |
Quick reminder of how decorators work | |
""" | |
from functools import wraps | |
def goat_inspect(f): | |
""" | |
^^^ this is the name of our decorator - interface | |
""" | |
@wraps(f) |
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
10 PRINT "HAPPY XMAS "; | |
20 POKE 53280, 0 | |
30 POKE 54281, 0 | |
40 FOR X = 1 TO 500 | |
50 NEXT X | |
60 PRINT "HAPPY CHRISTMAS "; | |
70 POKE 53280, 2 | |
80 POKE 53281, 2 | |
90 FOR Y = 1 TO 500 | |
100 NEXT Y |
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
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
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
# 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
""" | |
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
# 1. Install GraphViz | |
chris@ubuntu:~/src$ sudo apt-get install graphviz | |
[sudo] password for chris: | |
Reading package lists... Done | |
Building dependency tree | |
Reading state information... Done | |
The following extra packages will be installed: | |
libcdt4 libcgraph5 libgraph4 libgvc5 libgvpr1 libpathplan4 ttf-liberation | |
Suggested packages: |
NewerOlder