Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| The regex patterns in this gist are intended to match any URLs, | |
| including "mailto:[email protected]", "x-whatever://foo", etc. For a | |
| pattern that attempts only to match web URLs (http, https), see: | |
| https://gist.github.com/gruber/8891611 | |
| # Single-line version of pattern: | |
| (?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’])) |
| var fs = require('fs') | |
| , path = require('path') | |
| , _ = require('underscore'); | |
| var rootPath = "/path/to/remove"; | |
| removeDirForce(rootPath); | |
| // path should have trailing slash | |
| function removeDirForce(dirPath) { | |
| fs.readdir(dirPath, function(err, files) { |
| #!/bin/sh | |
| echo "What should the Application be called (no spaces allowed e.g. GCal)?" | |
| read inputline | |
| name="$inputline" | |
| echo "What is the url (e.g. https://www.google.com/calendar/render)?" | |
| read inputline | |
| url="$inputline" |
| #!/usr/bin/env ruby | |
| require "yaml" | |
| # make sure you have dump cookies to xunlei-cookies.txt | |
| YAML.load_file("all_files.yml").each do |file| | |
| cmd = "wget --load-cookies=xunlei-cookies.txt '#{file[:url]}' -c -O '#{file[:name]}'" | |
| system(cmd) | |
| end |
| http://s3.amazonaws.com/stanford_videos/cs229/videos/01.1-Introduction-Welcome.mp4 | |
| http://s3.amazonaws.com/stanford_videos/cs229/videos/01.b-Introduction-WhatIsMachineLearning.mp4 | |
| http://s3.amazonaws.com/stanford_videos/cs229/videos/01.3-Introduction-SupervisedLearning.mp4 | |
| http://s3.amazonaws.com/stanford_videos/cs229/videos/01.d-Introduction-UnsupervisedLearning.mp4 | |
| http://s3.amazonaws.com/stanford_videos/cs229/videos/02.1-LinearRegressionWithOneVariable-ModelRepresentation.mp4 | |
| http://s3.amazonaws.com/stanford_videos/cs229/videos/02.2-LinearRegressionWithOneVariable-CostFunction.mp4 | |
| http://s3.amazonaws.com/stanford_videos/cs229/videos/02.3-LinearRegressionWithOneVariable-CostFunctionIntuitionI.mp4 | |
| http://s3.amazonaws.com/stanford_videos/cs229/videos/02.4-LinearRegressionWithOneVariable-CostFunctionIntuitionII.mp4 | |
| http://s3.amazonaws.com/stanford_videos/cs229/videos/02.5-LinearRegressionWithOneVariable-GradientDescent.mp4 | |
| http://s3.amazonaws.com/stanford_videos/cs229/videos/02.6-LinearRegressionWithOneVariabl |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
| 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 |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| #!/bin/sh | |
| ## | |
| # This is a script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # Run in interactive mode with: | |
| # $ sh -c "$(curl -sL https://raw.github.com/gist/2108403/hack.sh)" | |
| # | |
| # or run it without prompt questions: |
| # Add speex, for Red5 | |
| brew edit ffmpeg | |
| args << "--enable-libspeex" if Formula.factory('speex').installed? | |
| brew install --use-gcc ffmpeg | |
| # H.264 / ACC | |
| ffmpeg -i video.flv -acodec libfaac -ab 19k -ar 16000 -vsync 1 -async 1 -r 25.0 -b 193k -vcodec libx264 -s 420x340 video.mp4 | |
| # VP8 / Vorbis |
| function formatjson() { | |
| local json="" | |
| if [ -p /dev/stdin ]; then | |
| # piping, e.g. `echo '{"foo":42}' | formatjson` | |
| while read -r line; do | |
| json="$json$line" | |
| done | |
| else | |
| # e.g. `formatjson '{"foo":42}'` | |
| json="$*" |