Skip to content

Instantly share code, notes, and snippets.

View mrTimofey's full-sized avatar

Timofey mrTimofey

View GitHub Profile
@mrTimofey
mrTimofey / glitch-text.vue
Created August 20, 2023 07:58
Glitch text effect
<script>
export default {
props: { value: String },
data: () => ({
clipBefore: [0, 0],
clipAfter: [0, 0],
skew: false
}),
methods: {
randomizeClip() {
@mrTimofey
mrTimofey / convert.sh
Created June 16, 2018 15:18
Convert audio for web
#!/bin/bash
if [ "$#" -eq 0 ]; then
echo "File name required"
exit
fi
echo -n "Bitrate (2000k): "
read bitrate
if [ "$bitrate" == "" ]; then
bitrate='2000'
@mrTimofey
mrTimofey / build.sh
Last active March 15, 2018 05:55
Simple Bitbucket webhook autodeploy
#!/usr/bin/env bash
# prevent simultaneous builds
while [ -f __build-lock ]; do
echo "Other build in progress, sleeping for 10 seconds"
sleep 10s
done
# just empty lock file to prevent multiple builds at the same time
touch __build-lock
@mrTimofey
mrTimofey / fastcgi-php.conf
Created March 9, 2018 04:36
PHP 7.2, php-fpm, nginx, A+ ssl, http2 config
index index.php index.html index.htm;
# process all non-existent files with /index.php
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
# php processing config
location ~ \.php$ {
try_files $uri /index.php =404;
@mrTimofey
mrTimofey / laravel-artisan-supervisor-queue.md
Last active March 9, 2018 04:37
Laravel Artisan supervisor queue handler

Enable supervisor service

sudo systemctl enable supervisor
sudo systemctl start supervisor

Create file /etc/supervisor/conf.d/WORKER_NAME-worker.conf with contents:

@mrTimofey
mrTimofey / postgresql-snippets.md
Last active March 9, 2018 04:38
PostgreSQL snippets (create database, create user, dump, restore)

Go to PostgreSQL CLI:

su - postgres
psql

Create user SQL

@mrTimofey
mrTimofey / ubuntu-locale-timezone.md
Last active March 9, 2018 04:38
Set locale and timezone on Ubuntu

Run locale -a to list all locales (ru_RU for Russian). Add locale if there is no needed one:

locale-gen ru_RU
locale-gen ru_RU.UTF-8

Set timezone with dpkg-reconfigure tzdata

@mrTimofey
mrTimofey / laravel-artisan-crontab.sh
Last active March 9, 2018 04:39
Laravel Artisan schedule with logging
crontab -l | { cat; echo "* * * * * ~/PROJECT/artisan schedule:run >> ~/PROJECT/storage/logs/crontab.log 2>&1"; } | crontab -
@mrTimofey
mrTimofey / logrotate
Created March 9, 2018 04:05
Logrotate all Laravel projects in /var/www
/var/www/*/storage/logs/*.log {
rotate 14
daily
compress
maxage 14
notifempty
create 644 www-data www-data
su www-data www-data
}
@mrTimofey
mrTimofey / install-all.md
Last active March 12, 2018 07:04
Install PHP 7.2, Supervisor, Node.js 9, PostgreSQL 10, MySQL 5.7+, Redis, nginx + Phusion Passenger on Ubuntu Server 16.04

PHP 7.2 + FPM

apt update
apt install python-software-properties
apt install software-properties-common
add-apt-repository -y ppa:ondrej/php
apt install mcrypt composer php7.2 php7.2-cli php7.2-common php7.2-fpm php7.2-curl php7.2-mbstring php7.2-xml php7.2-gd php7.2-pgsql
apt update
apt upgrade