Skip to content

Instantly share code, notes, and snippets.

View zviryatko's full-sized avatar
😱
Kill beavers - save tree!

Oleksandr Davyskiba zviryatko

😱
Kill beavers - save tree!
  • Ukraine, Kiev
View GitHub Profile
name: automated-tests
# only manual run
on:
workflow_dispatch:
jobs:
automated-tests:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v2
@zviryatko
zviryatko / Dockerfile
Created April 11, 2024 09:11
Drupal development
FROM skilldlabs/php:82 as spx
RUN apk update && apk add php82-dev libzip-dev libxml2-dev openssl git unzip acl zlib-dev autoconf g++ make \
&& cd /opt \
&& wget https://github.com/NoiseByNorthwest/php-spx/archive/refs/heads/master.zip -O php-spx.zip \
&& unzip php-spx.zip \
&& rm php-spx.zip \
&& cd php-spx-master \
&& phpize82 \
&& ./configure --with-php-config=/usr/bin/php-config82 \
&& make \
@zviryatko
zviryatko / Translate-video.md
Last active November 15, 2023 11:59
Extract subtitles from video and translate them

Put video file with name video.mp4

# create virtual env
python -m venv .venv
source .venv/bin/activate
# install dependencies for extracting audio file from video
pip install -r requirements.txt
python extract_audio.py
# install OpenAi Whisper to extract text and translate on the fly
pip install openai-whisper
@zviryatko
zviryatko / invoke.sh
Last active October 25, 2023 10:52
Invoke aws lambda with http request
#!/bin/bash
# Payload example:
# '{"httpMethod": "GET", "path": "/foo/bar"}'
FUNCTION_NAME=$1
PAYLOAD=$2
aws lambda invoke --function-name ${FUNCTION_NAME} --invocation-type RequestResponse --cli-binary-format raw-in-base64-out --payload "${PAYLOAD}" /tmp/response.json && cat /tmp/response.json | jq -r '.body' | jq
@zviryatko
zviryatko / README.md
Last active August 16, 2023 08:46
Useful bash scripts for analyzing AWS Aurora DB audit logs.

Usage

  1. Enable RDS logger
  2. Run some huge operations
  3. Download each audit log one by one in single folder.
  4. Run next command to join all logs to single file: cat * | awk -F "'" 'BEGIN{OFS="'\''"} NF-=1 {$1=""; print $0}' | cut -c2- > all.sql
  5. Download and run analyze.sh.

image

@zviryatko
zviryatko / BetterRestExportNested.php
Created August 7, 2023 20:03
Better REST export for Drupal 10 Views
<?php
namespace Drupal\better_rest_api\Plugin\views\display;
use Drupal\Core\Render\RenderContext;
use Drupal\Component\Utility\Html;
use Drupal\rest\Plugin\views\display;
use Drupal\views\Render\ViewsRenderPipelineMarkup;
/**
@zviryatko
zviryatko / gd-tutor.ipynb
Created April 13, 2023 12:14
Very simple NN with one layer
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zviryatko
zviryatko / RouteSubscriber.php
Created March 17, 2016 08:31
Hide forgot password links in Drupal 8.
<?php
/**
* @file
* Contains \Drupal\custom_user\Routing\RouteSubscriber.
*
* Put this file in "src/Routing" module directory.
*/
namespace Drupal\custom_user\Routing;
@zviryatko
zviryatko / README.md
Last active July 22, 2021 10:40
Nginx config to catch all .devel sites

This little gist help you to catch all *.devel domain and open localhost for it.

First you need to set up local DNS server and add it to resolv conf.

sudo apt-get install bind9 dnsutils resolvconf

bind9 - DNS server

resolvconf - help you to manage you /etc/resolv.conf file automatically independs on network configuration

@zviryatko
zviryatko / README.md
Last active December 3, 2018 16:02
phpstan for Drupal 8

Installation

  1. composer require --dev phpstan/phpstan
  2. Add composer patch https://github.com/phpstan/phpstan/pull/1080.patch
  3. Put this files to your project in phpstan directory
  4. Run it: ./bin/phpstan analyse -c ./phpstan/phpstan.neon -l max docroot/modules/custom/