Skip to content

Instantly share code, notes, and snippets.

@webmstk
webmstk / totp.php
Last active December 14, 2016 10:55
<?
class OneTimePasswordGenerator {
static $PASS_CODE_LENGTH = 6;
static $PIN_MODULO;
public function __construct() {
self::$PIN_MODULO = pow(10, self::$PASS_CODE_LENGTH);
}
public function getCode($base64Secret, $time = null) {
if (!$time) {
@webmstk
webmstk / totp.rb
Last active December 14, 2016 10:57
class OneTimePasswordGenerator
def initialize(pass_code_length = 6)
@pin_modulo = 10 ** pass_code_length
end
def get_code(base64_secret, time = nil)
time = (Time.current.to_i / 30).floor unless time
secret = Base64.decode64 base64_secret
<?require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';?>
<?
\Bitrix\Main\Loader::includeModule('iblock');
$ar = array();
$arFilter = array(
'IBLOCK_ID' => IBLOCK_REVIEWS_ID,
'ACTIVE' => 'Y',
<?require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';?>
<?
\Bitrix\Main\Loader::includeModule('iblock');
$ar = array();
$arSelect = array(
'ID',
'NAME',
<?require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';?>
<?
\Bitrix\Main\Loader::includeModule('iblock');
$ar = array();
$arFilter = array(
'IBLOCK_ID' => IBLOCK_CAT_ID,
'ACTIVE' => 'Y'
<?require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';?>
<?
\Bitrix\Main\Loader::includeModule('iblock');
$arSelect = array(
'ID',
'IBLOCK_ID',
'DETAIL_PICTURE'
);
<?require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';?>
<?
\Bitrix\Main\Loader::includeModule('iblock');
$arSelect = array(
'ID',
'NAME',
'DETAIL_TEXT',
'CREATED_DATE',

VPN-сервисы

Существует огромное количество VPN-сервисов. Вот два популярных варианта:

  1. https://nordvpn.com/ большие скидки при оплате за 2 и 3 года, возврат денег в течение 30 дней (если зайти на https://nordvpn.com/features/ и пролистать вниз, то появится попап со скидкой 77% — $99 за три года)
  2. https://www.privateinternetaccess.com/ старый, добротный

Таблица сравнения кучи VPN-сервисов https://thatoneprivacysite.net/vpn-comparison-chart/

См. также:

@webmstk
webmstk / scale-out-phoenix-with-websocket.md
Created May 23, 2022 17:16 — forked from Aetherus/scale-out-phoenix-with-websocket.md
How to scale out a Phoenix application with websocket

How to scale out a Phoenix application with websocket

Foreword

It's relatively easy to scale out stateless web applications. You often only need a reverse proxy. But for those stateful web applications, especially those applications that embeds websocket services in them, it's always a pain to distribute them in a cluster. The traditional way is introducing some external services like Redis to handle pubsub, however, in such way, you often need to change your code. Can Erlang/Elixir, the "concurrency oriented programming languages", best other languages in this use case? Has Phoenix framework already integrated the solution of horizontally scaling websocket? I'll do an experiment to prove (or disprove) that.

Resources

// 1.
int a = 13;
// 2.
double b = 12.8;
// 3.
var text = 'moon';
// Error: A value of type 'String' can't be assigned to a variable of type 'int'.