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
#! /bin/sh | |
## | |
# Loops through all the objects in the current directory. If the object is a git repo it | |
# performs a "git pull --rebase" and "git checkout master". | |
# | |
# To use as a shell command: | |
# | |
# OSX: | |
# Place this file in /usr/local/bin |
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 re, csv | |
reg = re.compile('(?<=Name: )(?P<faculty_name>.+)(?= HUID).+(?<=NETID: )(?P<faculty_3x3>.+)(?= EPPN)') | |
with open('grouper-export/groupExportAll_SPHFaculty.csv') as fdata: | |
freader = csv.reader(fdata) | |
with open('faculty-filenames.csv', 'w') as ffile: | |
fieldnames = ['faculty_name', 'faculty_3x3', 'filename'] | |
writer = csv.DictWriter(ffile, fieldnames=fieldnames) | |
writer.writeheader() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# Below function returns the index of the first number in the | |
# fibonacci sequence where first nine digits contain integers 1-9 | |
def first_nine(): | |
a, b, indexb = 1, 1, 2 | |
nine = set('123456789') | |
b_first_nine = set(str(b)[:9]) | |
while (nine <= b_first_nine) == False: | |
a, b, indexb = b, b + a, indexb + 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
Most of what I learned came from here: http://www.postgresql.org/docs/9.1/static/app-pgdump.html | |
The goal is to backup my application database into a single .sql file and store that on a network drive, so if my machine craps out I can get a new machine, reinstall Postgres and restore my database. | |
Here's the steps to do that on Windows 7: | |
Step 1: cd into Postgres bin directory so you can run pg_dump.exe | |
$ cd \Program Files\PostgreSQL\9.3\bin |
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
This stackoverflow question was a huge help: http://stackoverflow.com/questions/1887364/git-clone-to-external-drive-for-backup | |
If you use Git on you development machine, it's good to keep a remote backup in case your dev machine fails. | |
Step 1: Create the empty bare repo on your network drive | |
$ mkdir O:/myrepo_backup | |
$ cd O:/myrepo_backup | |
$ git init --bare |
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
This article was a huge help: http://evadeflow.com/2010/09/easy_install-through-a-proxy-server/ | |
Basically, what I learned is that you need to set both the http_proxy and https_proxy for setuptools easy_install to work. | |
It's worth mentioning I'm using this version of Python 2.7 on Windows 7 64-bit: http://www.activestate.com/activepython | |
From the Windows command prompt, I first set the two environment variables: | |
c:\> set http_proxy=<user>:<password>@<proxy_ip_address>:<port> |
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
# Provides warnings and error messages for debugging etc. | |
use strict; | |
# Importing the Win32::Netadmin module and one of its functions GroupGetMembers | |
use Win32::NetAdmin qw (GroupGetMembers); | |
# Syntax of GroupGetMembers function | |
# GroupGetMembers(server, groupName, userArrayRef) | |
# Fills userArrayRef with the members of groupName. |
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 steve(x,y): | |
"""where x is buyers of shirts and y is number of RSVPs""" | |
js = x * 35 | |
rsvp = y * 150 | |
total = jt + rsvp | |
print "Money from shirts: $" + str(js) | |
print "Money from RSVPs: $" + str(rsvp) | |
print "Total: $" + str(total) | |
steve(7,9) |