You can post a json file with curl
like so:
curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION
so for example:
#!/bin/bash | |
while :; do | |
verf=$(cat /dev/urandom | tr -dc '0-9' | fold -w 8 | head -n 1) | |
pin=$(cat /dev/urandom | tr -dc '0-9' | fold -w 5 | head -n 1) | |
ip=$(printf "%d.%d.%d.%d\n" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))") | |
[Enumerable][enumerable] is a mixin that is used to add additional functionality
to collection classes like Array
and Hash
. This means that you can use the
methods defined in Enumerable
on both arrays and hashes.
[Enumberable#map][map] is useful when you want to create a new array by iterating over some collection of values, and calculate a new value based on
function brush() { | |
// Use x.domain to filter the data, then find the max and min duration of this new set, and set y.domain to that | |
x.domain(brush.empty() ? x2.domain() : brush.extent()); | |
var dataFiltered = data.filter(function(d, i) { | |
if ( (d.date >= x.domain()[0]) && (d.date <= x.domain()[1]) ) { | |
return this; | |
} | |
}) | |
var buildersFiltered = color.domain().map(function(name) { | |
return { |
Created by Christopher Manning
[](http://bl.ocks.org/d/1703449/#/[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169]43/0/1) [](http://bl.ocks.org/d/1703449/#/
Vim has two modes insertion mode and command mode. The editor begins in command mode, where the cursor movement and text deletion and pasting occur. Insertion mode begins upon entering an insertion or change command. [ESC]
returns the editor to command mode (where you can quit, for example by typing :q!
). Most commands execute as soon as you type them except for "colon" commands which execute when you press the ruturn key.
:x
Exit, saving changes :q
Exit as long as there have been no changes ZZ
Exit and save changes if any have been made :q!
Exit and ignore any changes# Answer to a question on Flask mailing list | |
# http://librelist.com/browser//flask/2012/6/30/using-ajax-with-flask/ | |
# NOTE: *REALLY* don't do the thing with putting the HTML in a global | |
# variable like I have, I just wanted to keep everything in one | |
# file for the sake of completeness of answer. | |
# It's generally a very bad way to do things :) | |
# | |
from flask import (Flask, request, jsonify) | |
app = Flask(__name__) |