Skip to content

Instantly share code, notes, and snippets.

View maslenkov's full-sized avatar

Eugene Maslenkov maslenkov

View GitHub Profile
@satendra02
satendra02 / app.DockerFile
Last active July 12, 2024 02:39
docker+rails+puma+nginx+postgres (Production ready)
FROM ruby:2.3.1
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# Set an environment variable where the Rails app is installed to inside of Docker image:
ENV RAILS_ROOT /var/www/app_name
RUN mkdir -p $RAILS_ROOT
# Set working directory, where the commands will be ran:
@szromek
szromek / docker-compose.yml
Last active February 7, 2019 09:36
Docker compose for RoR application with debugger enabled
version: '2'
services:
db:
image: postgres
volumes:
- postgres-volume:/var/lib/postgresql/data
web:
build: .
command: rails s -b 0.0.0.0 -p 3000
volumes:
@wbotelhos
wbotelhos / clear-sidekiq-jobs.sh
Last active July 23, 2024 14:51
Clear Sidekiq Jobs
require 'sidekiq/api'
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
@PavloBezpalov
PavloBezpalov / 1. ELK.install
Last active January 5, 2024 16:14
ELK Stack with Rails (Elasticsearch, Logstash, Kibana) on Ubuntu VPS
INSTALL JAVA
$ sudo apt-get update && sudo apt-get install default-jre
INSTALL ELASTIC SEARCH https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html
$ wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
$ echo "deb https://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
$ sudo apt-get update && sudo apt-get install elasticsearch
$ sudo update-rc.d elasticsearch defaults 95 10
$ sudo service elasticsearch restart
$ sudo service elasticsearch status
@zulhfreelancer
zulhfreelancer / heroku_pg_db_reset.md
Last active June 17, 2024 11:44
How to reset PG Database on Heroku (for Rails app)?

It's important to note that running this reset will drop any existing data you have in the application

How to reset PG Database on Heroku?

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
  • Step 3: heroku run rake db:migrate
  • Step 4: heroku run rake db:seed (if you have seed)

One liner

# How to not use 'before_action :authorize_user!' in controllers
devise_for :users
root to: "home#index"
# this route for signed in users and guests
resources :games, only: [:show]
# create routes with redirect to sign_in for guests
authenticate(:user) do
@jurgens
jurgens / init_map.js.coffee
Created March 5, 2014 15:21
show single point on a google map
class InitMap
constructor: (element, data) ->
latlng = new google.maps.LatLng(data.lat, data.long)
options =
zoom: 12
center: latlng
mapTypeId: google.maps.MapTypeId.ROADMAP
map = new google.maps.Map(element, options)
@andrewvc
andrewvc / elasticsearch.conf
Created October 3, 2013 17:05
Upstart script for elasticsearch on ubuntu.... that actually works. Install the deb, and then run `sudo update-rc.d elasticsearch remove -f` to disable the init script.
# ElasticSearch upstart script
description "ElasticSearch service"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
@afair
afair / tmux.cheat
Last active June 3, 2024 23:26
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New new -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@dvydra
dvydra / gist:3422479
Created August 22, 2012 05:23
Click on filename in terminal and open file in rubymine
1) Install iTerm2, it's awesome.
2) locate your rubymine commandline integration thingy, it's usually `/usr/local/bin/mine`
3) Open iTerm2 preferences. Go to Profiles -> Default -> Advanced.
4) Select "Run command..." under Semantic History
5) Enter "/usr/local/bin/mine --line \2 \1" as the command