This file contains 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
# Linux. Act upon an event in a log file | |
# www.fduran.com | |
apt-get upgrade; apt-get install inotify-tools | |
# create file myalert.sh: | |
# example finding Exception in tomcat log and sending email | |
#!/bin/bash | |
while inotifywait -e modify /path/to/file.log; do |
This file contains 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
extern crate futures; | |
extern crate hyper; | |
extern crate tokio; | |
extern crate tokio_threadpool; // 0.1.4 | |
#[macro_use] | |
extern crate serde_derive; | |
extern crate serde; | |
extern crate serde_json; | |
use futures::sync::oneshot; |
This file contains 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 training_loop(n_epochs, model, optimiser, loss_fn, | |
train_input, train_target, test_input, test_target): | |
for i in range(n_epochs): | |
def closure(): | |
optimiser.zero_grad() | |
out = model(train_input) | |
loss = loss_fn(out, train_target) | |
loss.backward() | |
return loss | |
optimiser.step(closure) |