Skip to content

Instantly share code, notes, and snippets.

View FUT's full-sized avatar

Yury Koleda FUT

  • Rubyroid Labs
  • Poland
View GitHub Profile
@FUT
FUT / install-redis.sh
Last active April 19, 2022 11:16
Install Redis on EC2
1. Install Linux updates, set time zones, followed by GCC and Make
sudo yum -y update
sudo ln -sf /usr/share/zoneinfo/America/Indianapolis \
/etc/localtime
sudo yum -y install gcc make
2. Download, Untar and Make Redis 2.8 (check here http://redis.io/download)
@FUT
FUT / header_checks
Created November 14, 2014 10:22
Postfix email to Rails
# File: /etc/postfix/header_checks
# Add to the bottom of the file
/To:.*support@myapp.com.*/ FILTER send_to_my_app:
@FUT
FUT / apply.sh
Created November 24, 2014 14:12
Git config for a project
#!/bin/bash
# This file applies all the git configs and hooks related to current repository
# Run it from Rails.root directory this way:
# ./dev/git/apply.sh
cp -v dev/git/pre-commit .git/hooks/pre-commit
cp -v dev/git/config .git/config
@FUT
FUT / gist:0ebefa5e95a462c0749b
Created May 9, 2015 19:37
Convert images from CR2 to JPG in parallel
ls *.CR2 | parallel --will-cite --bar --jobs 8 ufraw-batch --out-type jpg --out-path jpg/ --overwrite
@FUT
FUT / api.rb
Created August 30, 2015 06:56
Log params and request time for grape
require 'grape'
class API < Grape::API
before do
@log_start_t = Time.now
Rails.logger.info " Parameters: #{params.to_hash.except("route_info")}"
end
after do
@log_end_t = Time.now
@FUT
FUT / app.conf
Created March 16, 2016 16:16
Rails + Angular/Ember/React on the same server
#
# Define your upstream cluster
#
upstream rails {
server 0.0.0.0:3000 fail_timeout=0;
}
server {
listen 80;
server_name your_app.dev;
@FUT
FUT / main_config.rb
Last active March 28, 2016 21:29
Backup PSQL and S3
Logger.configure do
syslog.ident = File.dirname(__FILE__) + "/../../log/radium_backup"
end
@FUT
FUT / shell_commands.sh
Created March 31, 2016 15:53
Send email on boot (Ubuntu)
sudo apt-get install mailutils
crontab -e
# And paste following line to crontab settings:
@reboot echo "Server has restarted "`hostname` | mail -s "System Restart" example@example.com
@FUT
FUT / puma.md
Last active April 1, 2016 08:37
Server startup

Remote server

  sudo apt-get install monit

Unomment several lines in monitrc config:

  sudo vim /etc/monit/monitrc
 
@FUT
FUT / README.txt
Created March 20, 2017 09:47
SystemD timers
sudo systemctl daemon-reload
sudo systemctl enable exporter.timer
sudo systemctl status exporter.timer
sudo systemctl list-timers --all
sudo systemctl list-timers
sudo systemctl start exporter.service
sudo systemctl start exporter.timer