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'); |
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'); |
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
input = [[1, 2, 3], [1, 3, 1], [1, 4, 2]] | |
total = [0, 0, 0] | |
for i in range(0, 3): | |
for row in input: | |
if row[i] != input[0][i]: | |
total[i] = total[i] + row[i] | |
else: | |
total[i] = row[i] |
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
(def input [[1,2,3],[1,3,4],[1,5,6]]) | |
(defn is-list-unique [input] | |
"Takes a list and returns first element if they are all the same and sum of elements if not" | |
(if (every? #{(first input)} (rest input)) | |
(first input) | |
(apply + input)) | |
) | |
(defn are-lists-unique [input] |
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
; Define a vector of vectors | |
(def input [[1,2,3],[1,3,4],[1,5,6]]) | |
; Calling the 'list' function on this: | |
user=> (list input) | |
; Gives us a single item list whose one and only member is this | |
; vector of vectors: | |
([[1 2 3] [1 3 4] [1 5 6]]) | |
; Mapping the 'list' function to input _applies_ |
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
clear | |
export PS1=$ | |
free="$(( $(vm_stat | awk '/free/ {gsub(/\./, "", $3); print $3}') * 4096 / 1048576)) MiB free" | |
echo \*\*\*\* bash $BASH_VERSION \*\*\*\* | |
echo | |
echo $free | |
echo | |
echo READY. |
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: |
OlderNewer