Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Umid umidjons

🏠
Working from home
View GitHub Profile
@umidjons
umidjons / telegram-bot-api-send-excel-file.md
Created Jul 13, 2018
Send an Excel file into Telegram group using node-telegram-bot-api
View telegram-bot-api-send-excel-file.md

Send an Excel file into Telegram group using node-telegram-bot-api

import * as TelegramBot from 'node-telegram-bot-api';
import * as fs from 'fs';

const TOKEN = '<your_token_got_from_gotfather>';
const GROUP_ID = '<your_group_id>';
const FILE = './data.xlsx';
@umidjons
umidjons / form_for_merchant_api.html
Last active May 8, 2018
A form for Merchant API
View form_for_merchant_api.html
<form method="POST" action="https://test.paycom.uz">
<input type="hidden" name="merchant" value="5aec04053f3861ae47378173"/>
<input type="hidden" name="amount" value="100"/> <!-- Amount in coins -->
<input type="hidden" name="account[Ebook]" value="1"/>
<input type="hidden" name="lang" value="en"/>
<button type="submit">Checkout</button>
</form>
@umidjons
umidjons / install-payme-magento-gateway.md
Created Apr 3, 2018
Installing Payme Magento Plugin
View install-payme-magento-gateway.md

Installing Payme Gateway for Magento

Prepare the container

docker pull alexcheng/magento2:2.2.1
git clone https://github.com/alexcheng1982/docker-magento2.git
cd docker-magento2/
git checkout 2.2.1
@umidjons
umidjons / cancel-transaction-method.php
Created Mar 7, 2018
CancelTransaction example on DLE
View cancel-transaction-method.php
<?php
class MerchantAPI {
public function CancelTransaction($id, $reason)
{
if (is_array($this->Authorize())) {
return $this->Authorize();
}
foreach ($this->errors as $k => $v) {
@umidjons
umidjons / createtransaction-check-other-transaction-for-order.php
Last active Feb 6, 2018
Check, is there any other transaction for this order
View createtransaction-check-other-transaction-for-order.php
<?php
// ...
// todo: Check, is there any other transaction for this order/service
$transaction = new Transaction();
$found = $transaction->find(['account' => $this->request->params['account']]);
if ($found) {
if (($found->state == Transaction::STATE_CREATED || $found->state == Transaction::STATE_COMPLETED)
&& $found->paycom_transaction_id !== $this->request->params['id']) {
$this->response->error(
PaycomException::ERROR_COULD_NOT_PERFORM,
@umidjons
umidjons / generate-random-string-password-from-linux-terminal.md
Created Jan 19, 2018
Generate random string (password) from linux terminal
View generate-random-string-password-from-linux-terminal.md

Generate random string (password) from Linux terminal

Here we are generating 20 length random string. We can use them as password.

tr -dc A-Za-z0-9_ < /dev/urandom | head -c 20 | xargs

Sample outputs:

@umidjons
umidjons / wordpress-with-docker-compose.md
Last active Dec 6, 2017
Wordpress with Docker Compose
View wordpress-with-docker-compose.md

Wordpress with Docker Compose

File docker-compose.yml

version: '3'

services:
  nginx:
    image: nginx:latest
    ports:
@umidjons
umidjons / putty-key-to-openssh-format.md
Created Oct 24, 2017
Convert putty ssh key to openssh format
View putty-key-to-openssh-format.md

Convert to OpenSSH format

# convert
sudo puttygen putty-generated.ppk -O private-openssh -o openssh-format.ppk

# copy to .ssh/ folder
cp openssh-format.ppk ~/.ssh/

# connect to a host using generated key
@umidjons
umidjons / connect-release-dockerization.md
Last active Oct 16, 2017
Dockerization of the connect-release
View connect-release-dockerization.md

Dockerization of the connect-release

Dockerfile

Folder structure:

|_ project
  |_ assets
    |_ connect-release.tar.gz
@umidjons
umidjons / youtube-dl-download-audio-only-on-best-quality.md
Last active Sep 25, 2020
Download Audio from YouTube with youtube-dl
View youtube-dl-download-audio-only-on-best-quality.md

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

You can’t perform that action at this time.