Skip to content

Instantly share code, notes, and snippets.

@sshymko
sshymko / install_pecl_imagick_amzn2.sh
Last active Sep 7, 2022
Install latest ImageMagick 7.x and imagick PHP extension from PECL on Amazon Linux 2
View install_pecl_imagick_amzn2.sh
#!/bin/sh
# Uninstall ImageMagic library and imagick PHP extension using it (installed previously)
yum remove -y php-pecl-imagick ImageMagick
# Install libraries for JPG, PNG, GIF, WebP, and TIFF image formats
yum install -y libpng-devel libjpeg-devel openjpeg2-devel libtiff-devel libwebp-devel giflib-devel
# Install latest ImageMagick library compiled from downloaded sources
yum install -y gcc
@sshymko
sshymko / install_mysql_client.sh
Last active Aug 29, 2022
Install MySQL 5.7 client on Amazon Linux 2
View install_mysql_client.sh
#!/bin/sh
sudo yum install -y https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
sudo yum install -y mysql-community-client
@sshymko
sshymko / aws_codepipeline_lambda_invalidate_cloudfront.js
Last active Jul 12, 2022
Invalidate CloudFront distribution from CodePipeline via Lambda function
View aws_codepipeline_lambda_invalidate_cloudfront.js
const aws = require('aws-sdk');
const codepipeline = new aws.CodePipeline();
const cloudfront = new aws.CloudFront();
exports.handler = async (event, context) => {
let job = event['CodePipeline.job'];
let config = job.data.actionConfiguration.configuration.UserParameters;
try {
let params = JSON.parse(config);
if (!params || !params.distributionId) {
@sshymko
sshymko / install_nginx_php7_amzn2_remi.sh
Last active Jun 21, 2022
Install Nginx and PHP-FPM on Amazon Linux 2 from REMI repository
View install_nginx_php7_amzn2_remi.sh
#!/bin/sh
sudo yum update -y
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum-config-manager --setopt="remi-php72.priority=5" --enable remi-php72
sudo yum install -y nginx
sudo systemctl enable nginx
@sshymko
sshymko / Dockerfile
Created Aug 17, 2019
Docker image of PHP 7.4 with Foreign Function Interface (FFI) support
View Dockerfile
FROM phpdaily/php:7.4.0-dev
RUN apk add --no-cache --virtual .persistent-deps libffi-dev \
&& docker-php-ext-configure ffi --with-ffi \
&& docker-php-ext-install ffi
@sshymko
sshymko / .zshrc
Last active Jan 4, 2022
Zsh configuration of cursor navigation and colors
View .zshrc
autoload -U select-word-style
select-word-style bash
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
export PROMPT='%F{cyan}%n%f@%F{green}%m:%f%B%F{yellow}%0~%f%b%(!.#.$) '
@sshymko
sshymko / DefaultKeyBinding.dict
Last active Dec 1, 2021
macOS key mapping for PC keyboard navigation
View DefaultKeyBinding.dict
{
/*
~/Library/KeyBindings/DefaultKeyBinding.dict
*/
// Home/End Keys
"\UF729" = "moveToBeginningOfLine:"; // Home
"\UF72B" = "moveToEndOfLine:"; // End
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; // Shift + Home
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; // Shift + End
@sshymko
sshymko / sysctl.conf
Created Dec 1, 2021
macOS TCP connection keep alive
View sysctl.conf
net.inet.tcp.keepidle=20000
net.inet.tcp.keepintvl=20000
net.inet.tcp.keepinit=20000
net.inet.tcp.always_keepalive=1
@sshymko
sshymko / redis.service
Last active Oct 15, 2021
Redis service for systemd on Linux
View redis.service
[Unit]
Description=Redis persistent key-value storage
After=network.target
[Service]
Type=notify
ExecStart=/usr/bin/redis-server /etc/redis.conf --supervised systemd --daemonize no
ExecStop=/usr/bin/redis-cli -p 6379 shutdown
ExecReload=/bin/kill -USR2 $MAINPID
Restart=always
@sshymko
sshymko / chrome_update_block.sh
Last active Oct 27, 2020
Google Chrome auto-update block for Mac OS
View chrome_update_block.sh
#!/bin/sh
sudo tee -a /etc/hosts << EOF
# Block Google Chrome auto-update
0.0.0.0 tools.google.com
EOF