Forwarded from Segment@tion fault
Элементарные вещи, которые делают неправильно, сужу по некоторым своим сотрудникам:
- oauth авторизация. Привязывают к email. Этого делать нельзя! Ладно в Google e-mail статический и навсегда. Но у FB, GitHub, Twitter и еще у 100500 провайдеров его можно менять. Поменял емейл - потерял доступ, отлично.
Привязывать oauth можно и нужно только к sub.
- традиционная авторизация. мыло-пароль, подтверждение мыла, "я забыл пароль" - опять подтверждение, смена мыла - опять подтверждение. Таблица аккаунта юзера обрастает какими-то страшными полями "код подтверждения емейла", "код подтверждения смены", "время, когда код был сгенерен", "время, когда код 2 был сгенерен".
Это - нехорошо, немасштабируемо и совершенно отвратительно читать. Как лучше?
- любая key-value db или kv-табличка в SQL
- key высылается юзеру
- value содержит метод и его параметры
- метод запускается, когда юзер нажал на URL с ключем, ввел ключ из смс или прописал ключ в TXT-запись своего домена
- PROFIT
- oauth авторизация. Привязывают к email. Этого делать нельзя! Ладно в Google e-mail статический и навсегда. Но у FB, GitHub, Twitter и еще у 100500 провайдеров его можно менять. Поменял емейл - потерял доступ, отлично.
Привязывать oauth можно и нужно только к sub.
- традиционная авторизация. мыло-пароль, подтверждение мыла, "я забыл пароль" - опять подтверждение, смена мыла - опять подтверждение. Таблица аккаунта юзера обрастает какими-то страшными полями "код подтверждения емейла", "код подтверждения смены", "время, когда код был сгенерен", "время, когда код 2 был сгенерен".
Это - нехорошо, немасштабируемо и совершенно отвратительно читать. Как лучше?
- любая key-value db или kv-табличка в SQL
- key высылается юзеру
- value содержит метод и его параметры
- метод запускается, когда юзер нажал на URL с ключем, ввел ключ из смс или прописал ключ в TXT-запись своего домена
- PROFIT
Эмуляция плохого интернет соединения для mac os
https://nshipster.com/network-link-conditioner/
https://nshipster.com/network-link-conditioner/
NSHipster
Network Link Conditioner
App developers often forget to test how their apps perform under less-than-ideal networking environments. Learn how you can use the Network Link conditioner to simulate a spotty Internet connection on your device.
#tor #linux #debian
Быстро поднять Tor мост на VPS c debian bullseye.
Obtain bridge's fingerprint:
Update the obfs4 config with your IP address, port and fingerprint:
Restart tor:
Check that tor running sucessfully:
Быстро поднять Tor мост на VPS c debian bullseye.
sudo ufw allow 9023
sudo apt install apt-transport-https
sudo -i
echo "deb [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org bullseye main" >> /etc/apt/sources.list
echo "deb-src [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org bullseye main" >> /etc/apt/sources.list
wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --dearmor | tee /usr/share/keyrings/tor-archive-keyring.gpg >/dev/null
sudo apt update
sudo apt install tor deb.torproject.org-keyring
sudo apt install obfs4proxy
sudo setcap cap_net_bind_service=+ep /usr/bin/obfs4proxy
sudo sed -i 's/NoNewPrivileges=yes/NoNewPrivileges=no/' /lib/systemd/system/[email protected]
sudo systemctl daemon-reload
sudo tee -a /etc/tor/torrc > /dev/null <<EOT
Log notice file /var/log/tor/log
ORPort 9023
AssumeReachable 1
ExtORPort auto
BridgeRelay 1
PublishServerDescriptor 0
ExitPolicy reject *:*
ServerTransportPlugin obfs4 exec /usr/bin/obfs4proxy
ServerTransportListenAddr obfs4 0.0.0.0:443
ContactInfo [email protected]
Nickname lain
EOT
sudo systemctl restart tor
Obtain bridge's fingerprint:
sudo cat /var/lib/tor/fingerprint
Update the obfs4 config with your IP address, port and fingerprint:
sudo vi /var/lib/tor/pt_state/obfs4_bridgeline.txt
Restart tor:
sudo systemctl restart tor
Check that tor running sucessfully:
sudo tail /var/log/tor/log
https://github.com/chubin/cheat.sh
example:
example:
➜ ~ cht.sh webm to mp4
/*
* As your input file report a strange frame rate value `1k fps` coming
* from the tbs and tbr value (look [here for their definition][1])
*
* the encoder generate a different result, `16k tbn, 1k tbc (default)`
*
* So by calling :
*/
ffmpeg -fflags +genpts -i 1.webm -r 24 1.mp4
/*
* You configure ffmpeg to generate new pts (a.k.a Presentation
* TimeStamp) for each frame and you set the target frame-rate to 24.
*
* So your output mp4 file info (`ffmpeg -i ....`) change from
*/
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 4327 kb/s, 1000.09 fps, 1k tbr, 16k tbn, 2k tbc
/* to */
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1670 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc
/*
* [1]: https://stackoverflow.com/questions/3199489/meaning-of-ffmpeg-
* output-tbc-tbn-tbr
*
* [alexbuisson] [so/q/18123376] [cc by-sa 3.0]
*/
➜ ~
GitHub
GitHub - chubin/cheat.sh: the only cheat sheet you need
the only cheat sheet you need. Contribute to chubin/cheat.sh development by creating an account on GitHub.
The owner of this channel has been inactive for the last 11 months. If they remain inactive for the next 29 days, they may lose their account and admin rights in this channel. The contents of the channel will remain accessible for all users.
The owner of this channel has been inactive for the last 11 months. If they remain inactive for the next 9 days, they may lose their account and admin rights in this channel. The contents of the channel will remain accessible for all users.