This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
module Books | |
class GenerateArticlesJob | |
include Sidekiq::Worker | |
sidekiq_options retry: 1 | |
sidekiq_retries_exhausted do |message, exception| | |
Rollbar.error(exception, message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Watermarking image with another image using Imagemagick 'composite', 'watermark' and 'dissolve'. | |
require "rmagick" | |
Dir.entries("./target").each_slice(7) do |group| | |
group.each do |target_photo| | |
next if target_photo == "." || target_photo == ".." | |
# This is necessary to don't explode your memory | |
GC.start | |
GC.disable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dependencies | |
# Usage: | |
# make | |
default: install | |
install: dependencies mysql memcached elasticsearch redis | |
dependencies: qt5 | |
brew tap homebrew/services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
vcr='(VCR)' | |
all_bettewen_quotes='(\".+\")' | |
declare -a files | |
count=0 | |
# Read file and get all cassettes from VCR | |
while read line; do | |
if [[ $line =~ $vcr ]]; then | |
[[ $line =~ $all_bettewen_quotes ]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateComments < ActiveRecord::Migration | |
def change | |
create_table :comments do |t| | |
t.references :post, null: false | |
t.references :user, null: false | |
t.text :description | |
t.timestamps | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DocumentUploader < CarrierWave::Uploader::Base | |
storage :file | |
def store_dir | |
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" | |
end | |
def extension_white_list | |
%w(pdf) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#For remove containers | |
sudo docker ps -a | grep Exit | awk '{print $1}' | sudo xargs docker rm | |
#For remove images | |
sudo docker rmi imageid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PS1='\[\e[01;30m\]\t `if [ $? = 0 ]; then echo "\[\e[32m\]✔"; else echo "\[\e[31m\]✘"; fi` \[\e[00;37m\]\u@\h\[\e[01;37m\] : `[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "\[\e[31m\]" || echo "\[\e[32m\]"`$(__git_ps1 "(%s)\[\e[00m\]")\[\e[01;34m\]\w\[\e[00m\] \n\$ ' | |
if [ -f ~/.bash_aliases ]; then | |
. ~/.bash_aliases | |
fi | |
export PATH="$HOME/.rbenv/bin:$PATH" | |
eval "$(rbenv init -)" | |
tmux -2 |
NewerOlder