Skip to content

Instantly share code, notes, and snippets.

@ayrat555
ayrat555 / gist:d725da7c2eb911b71f195407f69f8caa
Created August 8, 2021 04:34
isahc logs for el monitorro
This file has been truncated, but you can view the full file.
Aug 08 06:30:07 vps695005 bash[27061]: [2021-08-08T04:30:07Z INFO isahc::handler] response dropped without fully consuming the response body, which may result in sub-optimal performance
Aug 08 06:30:07 vps695005 bash[27061]: [2021-08-08T04:30:07Z DEBUG isahc::handler] Failure writing output to destination
Aug 08 06:30:07 vps695005 bash[27061]: [2021-08-08T04:30:07Z DEBUG isahc::handler] stopped the pause stream!
Aug 08 06:30:07 vps695005 bash[27061]: [2021-08-08T04:30:07Z DEBUG isahc::handler] Connection #41 to host dagelijksestandaard.nl left intact
Aug 08 06:30:07 vps695005 bash[27061]: [2021-08-08T04:30:07Z DEBUG isahc::handler] Trying 65.19.128.94:443...
Aug 08 06:30:07 vps695005 bash[27061]: [2021-08-08T04:30:07Z DEBUG isahc::handler] handler; id=7
Aug 08 06:30:07 vps695005 bash[27061]: [2021-08-08T04:30:07Z DEBUG isahc::handler] TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
named!(command<&str, &str>,
do_parse!(
com: take_until!(COMMAND_TERMINATOR) >>
tag!(COMMAND_TERMINATOR) >>
(com)
)
);
let s = "* * 5-7 1,2,5 8 sudo rm -rf /";
assert_eq!(
CronItem::from_str(s).unwrap(),
CronItem {
minute: AllValues,
hour: AllValues,
day_of_month: Interval((5, 7)),
month: MultipleValues(vec![1, 2, 5]),
day_of_week: SingleValue(8),
pub struct CronItem {
pub minute: TimeItem,
pub hour: TimeItem,
pub day_of_month: TimeItem,
pub month: TimeItem,
pub day_of_week: TimeItem,
pub command: String,
}
pub enum TimeItem {
AllValues,
SingleValue(u8),
MultipleValues(Vec<u8>),
Interval((u8, u8)),
}
defmodule QuotesBot do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
worker(QuotesBot.Polling.Server, []),
:poolboy.child_spec(:worker, poolboy_config())
]
defmodule QuotesBot.Bot.Server do
use GenServer
alias QuotesBot.{Bot.Logic, Config}
def start_link(_) do
GenServer.start_link(__MODULE__, nil, [])
end
def handle_cast({:reply, update}, _state) do
update_id = Logic.reply(update)
defmodule QuotesBot.Polling.Server do
use GenServer
alias QuotesBot.{Polling.Logic, Config}
def start_link do
GenServer.start_link(__MODULE__, 0, name: __MODULE__)
end
def init(offset) do
schedule_polling()
defmodule QuotesBot.Polling.Logic do
alias QuotesBot.Config
alias QuotesBot.Bot.Server, as: ReplyServer
alias Nadia.Model.Update
@telegram_api Config.telegram_api
@spec poll(integer()) :: integer()
def poll(offset) do
offset
|> updates
Y = (lambda (f)
((lambda (x) (f (x x)))
(lambda (x) (f (x x))))
(Y F) = ((lambda (x) (F (x x)))
(lambda (x) (F (x x))))
= (F ((lambda (x) (F (x x))) (lambda (x) (F x x))))
(Y F) = (F (Y F))