Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexander Polakov polachok

View GitHub Profile
@polachok
polachok / twisted.txt
Created Apr 6, 2022
nix-shell on ubuntu
View twisted.txt
$ nix-shell https://github.com/NixOS/nixpkgs/archive/941b4b8f048a383366e24c12022e99c87db09db6.tar.gz -A python39Packages.twisted
Sourcing python-remove-tests-dir-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing setuptools-build-hook
Using setuptoolsBuildPhase
Using setuptoolsShellHook
Sourcing pip-install-hook
Using pipInstallPhase
Sourcing python-imports-check-hook.sh
View configuration.nix
{ config, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
];
nixpkgs.config = {
allowUnfree = true;
packageOverrides = pkgs: {
unstable = import <nixos-unstable> {
@polachok
polachok / faq.md
Last active Sep 15, 2018
Futures & tokio FAQ (ru)
View faq.md

Что такое future?

Future это тип, для которого имплементирован трейт Future

Кто вызывает poll()?

Executor. Это может быть ивент-луп, тред пул или что-то еще.

@polachok
polachok / time.rs
Created Mar 29, 2018
chrono ser/de
View time.rs
```
#[derive(Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Serialize, Deserialize, Hash)]
pub struct Time {
// utc timestamp
timestamp: i64,
// timezone offset
offset: i32,
}
@polachok
polachok / yeah_sure.txt
Created May 19, 2017
Go doesn't use libc
View yeah_sure.txt
$ cat test.go
package main
import "os/user"
func main() {
_, _ = user.Current()
}
$ go build test.go
$ gdb ./test
View framed_delimited.rs
struct FramedTransport<T, C> where T: AsyncRead + AsyncWrite + 'static {
inner: length_delimited::Framed<T>,
codec: C,
}
fn framed_delimited<T, C>(framed: length_delimited::Framed<T>, codec: C) -> FramedTransport<T, C>
where T: AsyncRead + AsyncWrite, C: codec::Encoder + codec::Decoder
{
FramedTransport{ inner: framed, codec: codec }
}
@polachok
polachok / cpuinfo
Created Apr 14, 2017
Is hyper slow?
View cpuinfo
vendor_id : GenuineIntel
cpu family : 6
model : 63
model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
stepping : 2
microcode : 0x2e
cpu MHz : 3040.039
cache size : 30720 KB
physical id : 0
siblings : 24
View hub.txt
_____ _____ _____
/\ \ /\ \ /\ \
/::\____\ /::\____\ /::\ \
/:::/ / /:::/ / /::::\ \
/:::/ / /:::/ / /::::::\ \
/:::/ / /:::/ / /:::/\:::\ \
/:::/____/ /:::/ / /:::/__\:::\ \
/::::\ \ /:::/ / /::::\ \:::\ \
/::::::\ \ _____ /:::/ / _____ /::::::\ \:::\ \
/:::/\:::\ \ /\ \ /:::/____/ /\ \ /:::/\:::\ \:::\ ___\
View api.rs
impl AmqpClient {
fn call(&mut self, Request::Channel::Open) -> Future<Channel, AmqpError>
}
impl Channel {
fn declare_queue(&mut self, name: AsRef<str>) -> Future<Queue, AmqpError>
}
impl Queue {
fn consume(&mut self) -> Future<MessageStream, AmqpError>
View lol.txt
[/tmp]% cat test.txt
0
[/tmp]% cat test.php
<?php>
$file = fopen("test.txt", "r");
$buf = '';
while ($buf = fread($file, 1)) {
echo("inside\n");
}
echo("outside\n");