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
/* | |
Код взят отсюда и доработан | |
https://gist.github.com/ota42y/db4ff0298d9c945cd261 | |
Код применим только для y = ax + b | |
Для вертикальных прямых неприменим. | |
Least Squares Fitting: Perpendicular Offsets | |
Мы используем продвинутую версию метода наименьших квадратов, где меряется расстояние перпендикуляра до прямой | |
https://mathworld.wolfram.com/LeastSquaresFittingPerpendicularOffsets.html |
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
#![allow(unused)] | |
use std::collections::HashMap; | |
struct Locked; | |
struct Unlocked; | |
// PasswordManager<Locked> != PasswordManager<Unlocked> | |
struct PasswordManager<State = Locked> { |
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
#[macro_use] | |
use askama_rocket::{Template}; | |
use rocket::futures::executor::block_on; | |
use rocket::http::{ContentType, Status, Header}; | |
use rocket::local::asynchronous::Client; | |
use std::io::Cursor; | |
pub use askama::*; | |
pub use rocket::request::Request; |
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
/// # Custom JSON Responder for Rocket.io | |
/// | |
/// Allow to modify JSON response: | |
/// - Add custom headers | |
/// - send cookies | |
/// - etc... | |
/// | |
/// # Examples: | |
/// | |
/// ``` Cargo.toml |
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
<html> | |
<head> | |
<title>Checkout Example</title> | |
</head> | |
<body> | |
<form action="/charge" method="post" class="payment"> | |
<article> | |
<label class="amount"> | |
<span>Amount: $5.00</span> |
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
// | |
// Companion code to https://medium.com/statuscode/pipeline-patterns-in-go-a37bb3a7e61d | |
// | |
// To run: | |
// go get github.com/pkg/errors | |
// go run -race pipeline_demo.go | |
// | |
package main |
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
image: node | |
pipelines: | |
branches: | |
staging: | |
- step: | |
script: | |
- docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD | |
- make TAG=staging docker-build docker-push | |
- step: |
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
#!/bin/bash | |
# file: ttfb.sh | |
# curl command to check the time to first byte | |
# ** usage ** | |
# 1. ./ttfb.sh "https://google.com" | |
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com" | |
curl -o /dev/null \ | |
-H 'Cache-Control: no-cache' \ | |
-s \ |
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
I expected the first configuration below, simple.conf, to work just fine. | |
But it doesn't. My app server receives the second hit with the same URI as the first hit. | |
On the second config, wtf.conf, I keep the original URL on a variable to use in the error redirect. | |
My question is this: why doesn't the first simple.conf configuration works? |
NewerOlder