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
| " Using arrow keys to indent right/left in insert mode | |
| inoremap <Left> <Esc>:exe "normal mz<<`z".(&shiftwidth-1)."h"<CR>i | |
| inoremap <Right> <Esc>:exe "normal mz>>`z".(&shiftwidth+1)."l"<CR>i |
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
| Request URL:http://vote.skule.ca/vote?isstudent=True&isregistered=False&isundergrad=True&primaryorg=APSE&yofstudy=0&campus=STG&postcd=no_POStCD&attendance=ZZ&assocorg=&pid=c9bcc9f1ae24ff7617bdb4a0aa2c6488&hash=a6adb58c4d34d62eb6330c061ae38005 | |
| Request Method:GET | |
| Status Code:302 Moved Temporarily | |
| Request Headersview source | |
| Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 | |
| Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3 | |
| Accept-Encoding:gzip,deflate,sdch | |
| Accept-Language:en-US,en;q=0.8 | |
| Connection:keep-alive | |
| Cookie:voter_credentials=0505957c75d21c79053828d1deb076f4fcc8f3a73b942a070d49b4c91179e4a3fca6a0a11e07d8b9cf4dd39c6775a661b8524fe7c2af520aefc4ac8f807efe61%3A%3A3645; _SkuleVote_session=BAh7CjoPc2Vzc2lvbl9pZCIlNjJmZGQzYzA1ODdlNjE0OTg2YTNjNTdmOWVmZDkyYTYiGXZvdGVyX2NyZWRlbnRpYWxzX2lkaQI9DiIWdm90ZXJfY3JlZGVudGlhbHMiAYAwNTA1OTU3Yzc1ZDIxYzc5MDUzODI4ZDFkZWIwNzZmNGZjYzhmM2E3M2I5NDJhMDcwZDQ5YjRjOTExNzllNGEzZmNhNmEwYTExZTA3ZDhiOWNmNGRkMzljNjc3NWE2NjFiODUyNGZlN2MyYWY1MjBhZWZjNGFjOGY4MDdlZmU2MToQX2NzcmZfd |
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 bash | |
| while read pathname; do | |
| echo http://dl.dropbox.com/u/3423/${pathname#*Dropbox/Public/} | |
| done |
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
| (defn agent-die [state] | |
| (println (str (:id state) ": Alas! I am slain!")) | |
| (remove-watch *agent* :stepper) | |
| (swap! remaining-agents dec) | |
| (assoc state :alive false)) | |
| (defn agent-fn [state] | |
| (let [new-x (mod ((rand-dir) (:x state)) len-x) | |
| new-y (mod ((rand-dir) (:y state)) len-y) | |
| next-cell (at-loc new-x new-y)] |
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
| # Given dictionaries, d1 and d2, create a new dictionary with the following | |
| # property: for each entry (a, b) in d1, if there is an entry (b, c) in d2, then | |
| # the entry (a, c) should be added to the new dictionary. For example, if d1 is | |
| # {2:3, 8:19, 6:4, 5:12} and d2 is {2:5, 4:3, 3:9}, then the new dictionary | |
| # should be {2:9, 6:3} Associate the new dictionary with the variable d3 | |
| d3 = {} | |
| for (k, v) in d1.iteritems(): | |
| if v in d2: | |
| d3[k] = d2[v] |
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
| same = 0 | |
| for x in media.get_width(p1): | |
| for y in media.get_height(p1): | |
| p1_pix = media.get_pixel(p1, x, y) | |
| p2_pix = media.get_pixel(p2, x, y) |
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
| # Line 254 | |
| if x < media.get_width(picture2) and y < media.get_height(picture2): | |
| pixel2 = media.get_pixel(picture2, x, y) | |
| else: | |
| pixel2 = media.get_pixel(picture2, media.get_width(picture2)-1, media.get_height(picture2)-1) | |
| sum_of_difference = sum_of_difference + distance(pixel, pixel2) |
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 smart_difference(pic1, pic2): | |
| '''Take two pictures and tests how similar they are. Excuse the terrible docstrings. They need some work | |
| ''' | |
| h1 = get_height(pic1) | |
| h2 = get_height(pic2) | |
| w1 = get_width(pic1) | |
| w2 = get_width(pic2) | |
| if (h1 > h2): |
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 adjust_colours(target_pic, reference_pic): | |
| '''Takes target pic and adjusts it's average RGB values to reference pic's RGB values... | |
| ''' | |
| target_red_avg = red_average(target_picture) | |
| reference_red_avg = red_average(reference_picture) | |
| red_scale_factor = reference_red_avg/target_red_avg | |
| target_blue_avg = blue_average(target_picture) |
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
| # Note that these are just samples, and may not work unmodified... | |
| # Comparing pictures stored in picture_a and picture_b | |
| # Assumes: | |
| # 1. You've already resized the images to the same size | |
| # 2. The width & height of the images are stored in variables of the same names | |
| # 3. The images have been normalized to the same average intensity | |
| # 4. You've written a function named 'intensity' to calculate the intensity of | |
| # a given pixel |