Skip to content

Instantly share code, notes, and snippets.

View umidjons's full-sized avatar
🏠
Working from home

Umid umidjons

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

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 07:04
A form for Merchant API
<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 April 3, 2018 07:04
Installing Payme Magento Plugin

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 March 7, 2018 06:26
CancelTransaction example on DLE
<?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 February 6, 2018 11:25
Check, is there any other transaction for this order
<?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 January 19, 2018 11:27
Generate random string (password) from linux terminal

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 December 6, 2017 19:18
Wordpress with Docker Compose

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 October 24, 2017 12:18
Convert putty ssh key to openssh format

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 October 16, 2017 12:56
Dockerization of the connect-release

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 November 14, 2024 21:20
Download Audio from YouTube with youtube-dl

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track