Skip to content

Instantly share code, notes, and snippets.

@bogdanRada
bogdanRada / 00.howto_install_phantomjs.md
Created July 17, 2018 11:46 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@bogdanRada
bogdanRada / webpack-rails-1.markdown
Created July 17, 2018 11:44 — forked from jarednorman/webpack-rails-1.markdown
Webpack with Rails Part 1

Webpack with Rails Part 1

I don't like Sprockets, but it's the easiest and best choice for lots of Ruby on Rails projects. When looking for a better way to manage my JavaScript assets and an improved developer story, my current tool of choice is webpack. While I wish Rails supported drop-in asset pipelines the way that Phoenix does, it's not hard to use webpack with Rails.

@bogdanRada
bogdanRada / Install-Redis-Desktop-Manager.sh
Created July 10, 2018 16:43 — forked from thiagomgo/Install-Redis-Desktop-Manager.sh
Install Redis Desktop Manager from source on Ubuntu
# Clone the repository from GitHub
git clone --recursive https://github.com/uglide/RedisDesktopManager.git -b 0.8.0 rdm && cd ./rdm
# Compile the source
cd src/
./configure
source /opt/qt56/bin/qt56-env.sh && qmake && make
sudo checkinstall -D --install
sudo gdebi /home/$USER/rdm/src/src_*.deb
cd /usr/share/redis-desktop-manager/bin
@bogdanRada
bogdanRada / paperclip_migration.rake
Created July 5, 2018 09:36 — forked from jessecurry/paperclip_migration.rake
Rake task for migrating paperclip attachments stored on S3 when you have to change your path.
namespace :paperclip_migration do
desc 'Migrate data'
task :migrate_s3 => :environment do
# Make sure that all of the models have been loaded so any attachments are registered
puts 'Loading models...'
Dir[Rails.root.join('app', 'models', '**/*')].each { |file| File.basename(file, '.rb').camelize.constantize }
# Iterate through all of the registered attachments
puts 'Migrating attachments...'
@bogdanRada
bogdanRada / migrate_paperclip_to_s3.rake
Created July 5, 2018 09:36 — forked from awd/migrate_paperclip_to_s3.rake
Migrate local paperclip assets to Amazon S3.
##
# Use this behind the scenes to migrate files from your filesystem to Amazon S3
# %: rake paperclip_migration:migrate_to_s3
##
namespace :attachments do
desc "migrate files from filesystem to s3"
task :migrate_to_s3 => :environment do
require 'aws/s3'
@bogdanRada
bogdanRada / paperclip_s3_migrator.rb
Created July 5, 2018 08:32 — forked from brianjlandau/paperclip_s3_migrator.rb
This allows you to migrate files on S3 stored by paperclip to a new location.
# Example usage:
#
# PaperclipS3Migrator.new(
# [User, BlogPost, Page],
# ':attachment/:id/:style/:filename',
# ':class/:id/:attachment/:style/:updated_at_:filename'
# ).migrate
#
class PaperclipS3Migrator < Struct.new(:klasses, :old_path, :new_path)
@bogdanRada
bogdanRada / migrate_s3.rake
Created July 5, 2018 07:54 — forked from markets/migrate_s3.rake
Migrate Paperclip assets from filesystem to AWS S3
namespace :attachments do
task migrate_to_s3: :environment do
require 'aws-sdk'
# Define Paperclip models
models = [
[Attachment, :data],
[Image, :data],
[MediaAppearance, :media_logo],
[Testimonial, :avatar_logo]
@bogdanRada
bogdanRada / Dockerfile
Created June 26, 2018 18:02 — forked from t-yamo/Dockerfile
Vagrant & Dockfile sample (include git clone)
FROM centos
# ---- setup ssh
RUN yum install -y openssh-server
RUN yum install -y openssh-clients
# RUN sed -ri 's/^#PermitEmptyPasswords no/PermitEmptyPasswords yes/' /etc/ssh/sshd_config
# RUN sed -ri 's/^#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config
# - WARNING: 'UsePAM no' is not supported in Red Hat Enterprise Linux and may cause several problems.
@bogdanRada
bogdanRada / sl7prepareminimalguivagrant.sh
Created June 21, 2018 16:34 — forked from TomasKulhanek/README.md
Script to prepare SL7 vagrant box
# expected that SL7 is installed as minimal system, vagrant account as administrator, run with sudo privileges
yum groupinstall "X Window System"
yum -y install gnome-classic-session gnome-terminal nautilus-open-terminal control-center dejavu-sans-mono-fonts
systemctl set-default graphical.target
# enable ssh
systemctl enable sshd
yum install -y wget
mkdir -p /home/vagrant/.ssh
chmod 0700 /home/vagrant/.ssh
wget --no-check-certificate \
@bogdanRada
bogdanRada / manage-etc-hosts.sh
Created June 19, 2018 08:54 — forked from irazasyed/manage-etc-hosts.sh
Bash Script to Manage /etc/hosts file for adding/removing hostnames.
#!/bin/sh
# PATH TO YOUR HOSTS FILE
ETC_HOSTS=/etc/hosts
# DEFAULT IP FOR HOSTNAME
IP="127.0.0.1"
# Hostname to add/remove.
HOSTNAME=$1