from peewee import * | |
class BModel(Model): | |
class Meta: | |
database = db | |
@classmethod | |
def create_table(cls, *args, **kwargs): | |
for field in cls._meta.get_fields(): | |
if hasattr(field, "pre_field_create"): |
package main | |
import ( | |
"flag" | |
"io" | |
"log" | |
"net" | |
"net/http" | |
"strings" | |
) |
import ( | |
"fmt" | |
"strings" | |
"regexp" | |
) | |
var matchFirstCap = regexp.MustCompile("(.)([A-Z][a-z]+)") | |
var matchAllCap = regexp.MustCompile("([a-z0-9])([A-Z])") |
- Create a new Telegram bot:
- start a chat with BotFather;
- type
/newbot
, select a name (to be shown in chats) and handle for your bot; - note the bot token to access HTTP API - a long string with a colon in the middle (later referred to as
<token>
); - optionally
/setdescription
and/setuserpic
.
- Add the bot to the chat/channel and note its id:
- add the bot to a new or existing chat or group - this is where your bot will send notifications to;
- go to
https://api.telegram.org/bot<token>/getUpdates
(replace<token>
with your token); - within the
chat
part, find and note theid
field - a positive or negative number (later referred to as<chat_id>
).
- Programmatically send notifications:
package main | |
import ( | |
"context" | |
"log" | |
"net" | |
"os" | |
"os/signal" | |
"time" | |
) |
- NaiveProxy URIs should be standard URIs, not something using JSON and Base64 encoding, etc.
https
/quic
schemes shouldn't be used directly, since they can be confusing with the real protocols.
- schema :=
naive+https
|naive+quic
- username, password := basic auth info. when there's no auth, omit both.
- host := target host
- port can be omitted if it's 443, or specify it explicitly
- queries:
At the beginning of 2030, I found this essay in my archives. From what I know today, I think it was very insightful at the moment of writing. And I feel it should be published because it can teach us, Rust developers, how to prevent that sad story from happening again.
What killed Haskell, could kill Rust, too
What killed Haskell, could kill Rust, too. Why would I even mention Haskell in this context? Well, Haskell and Rust are deeply related. Not because Rust is Haskell without HKTs. (Some of you know what that means, and the rest of you will wonder for a very long time). Much of the style of Rust is similar in many ways to the style of Haskell. In some sense Rust is a reincarnation of Haskell, with a little bit of C-ish like syntax, a very small amount.
Is Haskell dead?