This file contains hidden or 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 | |
def walk(root, startTimestamp, stopTimestamp): | |
""" | |
Walk the filesystem, descending from C{root}, yielding the paths of | |
files with modification dates more recent than C{startTimestamp} and at | |
most as recent as C{stopTimestamp}. | |
The aim is that our caller should be able to use the value of |
This file contains hidden or 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 main(options): | |
saver = MetadataSaver(USERNAME, PASSWORD, INSTANCE, TAG, options.execute) | |
ts = Timestamp(TIMESTAMP_FILE) | |
oldest = ts.get() | |
newest = time.time() | |
for count, path in enumerate(walk(FILESYSTEM_ROOT, oldest, newest)): | |
logging.info('Modified file %d: %s' % (count, path)) | |
saver.save(path) | |
count += 1 | |
logging.info('Added metadata on %d file%s in %f seconds' % |
This file contains hidden or 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
#!/usr/bin/env python | |
from os import walk | |
for dirpath, dirnames, files in walk('.', topdown=False): | |
if not dirnames and not files: | |
print dirpath |
This file contains hidden or 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
monthNum = { | |
'jan' : 1, | |
'feb' : 2, | |
'mar' : 3, | |
'apr' : 4, | |
'may' : 5, | |
'jun' : 6, | |
'jul' : 7, | |
'aug' : 8, | |
'sep' : 9, |
This file contains hidden or 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
$ git push origin id-attribute-exception-when-anon-not-allowed | |
Counting objects: 186, done. | |
Delta compression using up to 2 threads. | |
Compressing objects: 100% (122/122), done. | |
Writing objects: 100% (138/138), 19.79 KiB, done. | |
Total 138 (delta 82), reused 0 (delta 0) | |
Write failed: Invalid argument | |
Write failed: Invalid argument | |
Write failed: Connection timed out | |
Write failed: Broken pipe |
This file contains hidden or 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
$ curl -v 'http://nhs-innovation.herokuapp.com/css/main.css' > /dev/null | |
* About to connect() to nhs-innovation.herokuapp.com port 80 (#0) | |
* Trying 174.129.192.155... % Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0connected | |
> GET /css/main.css HTTP/1.1 | |
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3 | |
> Host: nhs-innovation.herokuapp.com | |
> Accept: */* | |
> |
This file contains hidden or 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
ubuntu@domU-12-31-39-01-F0-08:~$ sudo apt-get install mdadm | |
Reading package lists... Done | |
Building dependency tree | |
Reading state information... Done | |
The following extra packages will be installed: | |
postfix | |
Suggested packages: | |
procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre sasl2-bin dovecot-common postfix-cdb mail-reader | |
postfix-doc | |
Recommended packages: |
This file contains hidden or 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
#!/bin/sh | |
file=/etc/postgresql/9.1/main/postgresql.conf | |
current=`egrep "^[ ]*bytea_output[ ]*=" $file | tr -d "' " | cut -f1 -d\# | tr = ' ' | cut -f2 -d' '` | |
case "$current" in | |
'' ) echo "bytea_output = 'escape'" >> $file ;; | |
escape) ;; # Do nothing, the existing value is correct. | |
hex) echo "Incompatible setting: $current"; exit 1;; | |
*) echo "wtf.... unknown value $current"; exit 2;; |
This file contains hidden or 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
/tmp $ mkvirtualenv xx | |
New python executable in xx/bin/python | |
Installing distribute.............................................................................................................................................................................................done. | |
Installing pip...............done. | |
virtualenvwrapper.user_scripts creating /home/terry/.virtualenvs/xx/bin/predeactivate | |
virtualenvwrapper.user_scripts creating /home/terry/.virtualenvs/xx/bin/postdeactivate | |
virtualenvwrapper.user_scripts creating /home/terry/.virtualenvs/xx/bin/preactivate | |
virtualenvwrapper.user_scripts creating /home/terry/.virtualenvs/xx/bin/postactivate | |
virtualenvwrapper.user_scripts creating /home/terry/.virtualenvs/xx/bin/get_env_details | |
(xx) /tmp/xx $ pip install django==1.4.1 |
This file contains hidden or 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
function parseFluidinfoValue(value){ | |
/* | |
* Parse a string into one of the 5 types of values recognized by | |
* Fluidinfo. | |
* | |
* param: value is a string | |
* | |
* return: a value of type | |
* | |
* null | [string, string, ...] | float | bool | string |