Skip to content

Instantly share code, notes, and snippets.

View javatask's full-sized avatar

Andrii Melashchenko javatask

View GitHub Profile
@javatask
javatask / ami2-drupal.sh
Created December 9, 2021 19:31
User data script for AWS EC2 instance based on AMI2
#!/bin/bash
sudo yum -y update
sudo amazon-linux-extras install -y php7.4
sudo yum install -y php-cli php-pdo php-fpm php-json php-mysqlnd php-dom php-gd php-simplexml php-xml php-opcache php-mbstring httpd
wget https://www.drupal.org/download-latest/tar.gz
tar -xzf tar.gz
mv drupal-* drupal
cd drupal
sudo rsync -avz . /var/www/html
sudo chown -R apache:apache /var/www/html
@javatask
javatask / perfmormance.csv
Created February 19, 2021 07:15
Web Site analytics
URL Mobile (0-100) Desktop (0-100) Links
https://diia.gov.ua/ 70 96 https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fdiia.gov.ua%2F&tab=desktop
https://thedigital.gov.ua/ 22 59 https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fthedigital.gov.ua%2F&tab=desktop
https://chamber.ua/ 33 74 https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fchamber.ua%2F&tab=desktop
https://eba.com.ua/ 15 48 https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Feba.com.ua%2F&tab=desktop
https://sup.org.ua/uk 8 28 https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fsup.org.ua%2Fuk&tab=desktop
@javatask
javatask / slackHook.js
Created February 15, 2021 14:16
Usage of Incoming webhooks for Slack
const https = require("https");
const { URL } = require("url");
const webHookUrl = process.env.WEBHOOK_URL || "fakeWebhook";
function publishSlackMessage({ message, webHook }) {
return new Promise(function (resolve) {
const url = new URL(webHook);
const reqOpts = {};
reqOpts.hostname = url.hostname;
reqOpts.path = url.pathname;
@javatask
javatask / convert.sh
Created February 6, 2021 18:09
Googles TextToSpeech sample
#!/bin/bash
# check https://cloud.google.com/text-to-speech/docs/quickstart-protocol to get token (subtitles-xxx.json) file
export GOOGLE_APPLICATION_CREDENTIALS="/home/alan/proj/google/textToSpeach/subtitles-xxx.json"
# check https://cloud.google.com/sdk/docs/install
# to install gcloud cli
curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
@javatask
javatask / index.js
Created October 24, 2019 13:17
Convert Google speech to text JSON into SRT
const text = require("./text.json");
function toHHMMSS(seconds) {
var sec_num = parseInt(seconds, 10); // don't forget the second param
var hours = Math.floor(sec_num / 3600);
var minutes = Math.floor((sec_num - hours * 3600) / 60);
var seconds = sec_num - hours * 3600 - minutes * 60;
if (hours < 10) {
hours = "0" + hours;