diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nobrowse -nomount ram://XXXXX`where XXXXX is the size of the RAM disk in terms of memory blocks.
Notes:
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| from collections import UserDict | |
| from unittest.mock import ANY | |
| class AnyDict(UserDict): | |
| """ | |
| Returns a dict that will use unittest.mock.ANY | |
| as a value for keys that present in dict it is | |
| going to be compared with for equality (or not equality), | |
| but not in dict itself. It will also ensure that comparing |
| import { stringify } from 'query-string'; | |
| const _fetch = (url, config) => { | |
| // Put query string params to url if query is given | |
| if (config !== undefined && 'query' in config) { | |
| url = `${url}?${stringify(config.query)}`; | |
| } | |
| return fetch(url, config).then( | |
| res => { |
| # | |
| # Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/) | |
| # Update July 2014: no longer offline, see https://digitaldj.net/blog/2011/11/17/trim-enabler-for-os-x-lion-mountain-lion-mavericks/ | |
| # | |
| # Looks for "Apple" string in HD kext, changes it to a wildcard match for anything | |
| # | |
| # Alternative to http://www.groths.org/trim-enabler-3-0-released/ | |
| # Method behind this madness described: http://forums.macrumors.com/showthread.php?t=1409151&page=4 | |
| # See discussion in comments here: https://www.macupdate.com/app/mac/39654/lion-tweaks | |
| # And here: http://forums.macrumors.com/showthread.php?t=1410459 |
| import collections | |
| CACHE = collections.defaultdict(set) | |
| CACHE[1].add(1) | |
| def divisors(n): | |
| if not CACHE[n]: |
| #!/usr/bin/env python | |
| from problem_18 import count_max_dynamically | |
| if __name__ == '__main__': | |
| with open('triangle.txt') as f: | |
| data_array = [map(int, line.split()) for line in f.readlines()] | |
| result = count_max_dynamically(data_array) | |
| print(result) |
| #!/usr/bin/env python | |
| DATA = """\ | |
| 75 | |
| 95 64 | |
| 17 47 82 | |
| 18 35 87 10 | |
| 20 04 82 47 65 | |
| 19 01 23 75 03 34 |
| #!/usr/bin/env python | |
| import re | |
| import sys | |
| import unittest | |
| NUMBERS = { | |
| 1: 'one', | |
| 2: 'two', | |
| 3: 'three', |