Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| var match = [] | |
| var _finalizeExpr = function(match) { | |
| var vs = match[0] | |
| var _iter = match[1] | |
| var _done = match[2] | |
| var i = 0 | |
| var _iterWrappper = function() { | |
| if(i === vs.length) { |
| // Lack of tail call optimization in JS | |
| var sum = function(x, y) { | |
| return y > 0 ? sum(x + 1, y - 1) : | |
| y < 0 ? sum(x - 1, y + 1) : | |
| x | |
| } | |
| sum(20, 100000) // => RangeError: Maximum call stack size exceeded | |
| // Using workaround |
| tell application "iPhone Simulator" | |
| activate | |
| end tell | |
| tell application "System Events" | |
| tell process "iPhone Simulator" | |
| tell menu bar 1 | |
| tell menu bar item "iOS Simulator" | |
| tell menu "iOS Simulator" | |
| click menu item "Reset Content and Settings…" |
| < | |
| %3C | |
| < | |
| < | |
| < | |
| < | |
| < | |
| < | |
| < | |
| < |
| // | |
| // NSObject+setValuesForKeysWithJSONDictionary.h | |
| // SafeSetDemo | |
| // | |
| // Created by Tom Harrington on 12/29/11. | |
| // Copyright (c) 2011 Atomic Bird, LLC. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.h> |
| /** | |
| # eq.js: minimalistic equation evaluator. | |
| eq(str, vars) | |
| Features: | |
| - evaluate variables in the `vars` object | |
| - `str` can use any `Math` function or property: round, ceil, max, E |
| #!/usr/bin/env bash | |
| # | |
| # Copyright (c) 2013 Jonathan Penn (http://cocoamanifest.net) | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal | |
| # in the Software without restriction, including without limitation the rights | |
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| # copies of the Software, and to permit persons to whom the Software is | |
| # furnished to do so, subject to the following conditions: |
| # Here a few bash one-liners that helped me analyze / fight a weak DOS attack against debuggable.com. Mostly for future reference. | |
| # The attacker was opening lots of tcp connections without sending data, I believe it's called a SYN flood, see: http://tools.ietf.org/html/rfc4987#section-3.2 | |
| # Step 0: Check what is going on at port 80 | |
| $ netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c | |
| # Step 1: Increase the number of available fds | |
| $ ulimit -n 32000 | |
| # Step 2: Restart your webserver, for me: |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 Mathieu 'p01' Henri - http://www.p01.org/releases/ | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |