Skip to content

Instantly share code, notes, and snippets.

View antirek's full-sized avatar

Dmitriev Sergey antirek

  • Mobilon Telecom / mobilon.ru
  • Krasnoyarsk
  • 18:36 (UTC +07:00)
View GitHub Profile
@antirek
antirek / jssip.md
Created September 24, 2022 16:20 — forked from dtolb/jssip.md
JsSip Demo

#JSSIP with Catapult API ​ ##Prerequisites ​

  • Register for a Catapult (Bandwidth Application Platform) account here
  • Register a SIP domain
  • Create an endpoint/user
  • If you want to make calls to the PSTN (normal phones) you will need a server to handler events from Catapult
  • Make phone calls ​
const axios = require('axios');
class YandexApiClient {
constructor(config) {
this.config = config;
}
async recognizeShortAudio(fileBuffer) {
const response = await axios({
method: 'post',
<template>
<q-page class="bg-light-green window-height window-width row justify-center items-center">
<div class="column">
<div class="row">
<h5 class="text-h5 text-white q-my-md">Company & Co</h5>
</div>
<div class="row">
<q-card square bordered class="q-pa-lg shadow-1">
<q-card-section>
<q-form class="q-gutter-md">
@antirek
antirek / Dialog.vue
Created March 19, 2021 18:10 — forked from skushnerchuk/Dialog.vue
Quasar dialog
<template>
<q-dialog ref="dialog" @hide="onDialogHide">
<q-card style="min-width: 450px">
<q-card-section>
<span v-if="title">
{{ title }}
<q-space style="height: 10px"/>
</span>
https://github.com/jarkt/docker-remote-api
https://blog.usejournal.com/how-to-enable-docker-remote-api-on-docker-host-7b73bd3278c6
How add simple auth?
@antirek
antirek / tokens.md
Created October 11, 2019 16:03 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Основы:

Аутентификация(authentication, от греч. αὐθεντικός [authentikos] – реальный, подлинный; от αὐθέντης [authentes] – автор) - это процесс проверки учётных данных пользователя (логин/пароль). Проверка подлинности пользователя путём сравнения введённого им логина/пароля с данными сохранёнными в базе данных.

Авторизация(authorization — разрешение, уполномочивание) - это проверка прав пользователя на доступ к определенным ресурсам.

Например после аутентификации юзер sasha получает право обращатся и получать от ресурса "super.com/vip" некие данные. Во время обращения юзера sasha к ресурсу vip система авторизации проверит имеет ли право юзер обращатся к этому ресурсу (проще говоря переходить по неким разрешенным ссылкам)

@antirek
antirek / yandex-cloud-speechkit-tts-nodejs.js
Created July 19, 2019 10:33
Yandex Cloud SpeechKit (TTS) Example on Node.js - Пример работы с API технологии синтеза речи Yandex Cloud SpeechKit
const fetch = require('node-fetch');
const api_key = 'API_KEY';
const { URLSearchParams } = require('url');
const fs = require('fs');
const params = new URLSearchParams();
const text = 'Добрый день, у нас новая акция! Пицца Добряк сегодня за полцены, закажите по телефону 222. Уже ждем вашего заказа :) '
params.append('text', text);
1. Тебе надо — ты и делай.
Каждый раз, когда в разговоре звучит слово «надо», когда речь идёт о долге или обязательствах, стоит задавать вопрос «Кому это надо?». Манипуляторы любят умалчивать о том, что желаемое нужно в первую очередь им. Например, фраза родителей «Тебе надо найти работу», очищенная от манипуляций, будет звучать так: «Мне надо, чтобы ты прекратил сидеть у меня на шее и пошёл работать». А пока отроку не надо идти работать, ему удобно сидится на шее.
2. Не обещай. Если обещал — выполни.
Вспомните, как часто под давлением других людей вы давали необдуманные обещания. Манипулятор будет специально подталкивать вас давать необдуманные обещания, а потом эксплуатировать ваше чувство вины. Просто не обещайте, но если уж пообещали — выполните. Тогда в следующий раз подумаете дважды, прежде чем брать на себя лишние обязательства.
3. Не просят — не лезь.
@antirek
antirek / gist:91f850eae9f4a1738cc4bc8242eb62e3
Created March 21, 2019 06:54
mysql queries for search prefixes
mysql> SELECT `id`,`name`,`prefix` FROM `destinations` WHERE 841221234567
like concat(prefix,’%’) order by prefix desc limit 1;
———-————————+————+ | id | name | prefix |
———-————————+————+ | 23269 | VIETNAM MOBILE | 84122 |
———-————————+————+
1 row in set (0.08 sec)
mysql> SELECT `id`,`name`,`prefix` FROM `destinations` WHERE 93751234567
like concat(prefix,’%’) order by prefix desc limit 1;
———————————+————+ | id | name | prefix |
@antirek
antirek / revert-a-commit.md
Created November 14, 2018 06:59 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32: