Skip to content

Instantly share code, notes, and snippets.

View j3ck's full-sized avatar
🏠
Working from home

Eugene j3ck

🏠
Working from home
View GitHub Profile
@j3ck
j3ck / site.conf
Created March 18, 2016 15:06 — forked from paskal/site.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
@j3ck
j3ck / dragonfly_tasks.rake
Created April 30, 2016 08:03 — forked from lassebunk/dragonfly_tasks.rake
Migrate all Dragonfly images to Amazon S3 using rake task
# This will move all images and other Dragonfly assets from your local server file system to Amazon S3.
namespace :dragonfly do
task :migrate_to_s3 => :environment do
# Adjust this line to meet your needs:
{ Product => [:image_uid, :other_uid], Page => :image_uid }.each do |klass, col|
puts "Migrating #{klass.table_name}..."
Array(col).each do |col|
klass.where("#{col} != ''").find_each do |instance|
begin
#log active record from console
ActiveRecord::Base.logger = Logger.new(STDOUT)
@j3ck
j3ck / redis.markdown
Created July 13, 2016 19:31 — forked from bdotdub/redis.markdown
Running redis using upstart on Ubuntu

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

# /lib/systemd/system/nginx.service
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/opt/nginx/logs/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
@j3ck
j3ck / json
Created December 26, 2016 09:24
json ~1.7 - gem install bundler -v '= 1.5.1'
@j3ck
j3ck / rt.sh
Created December 27, 2016 16:06
each dir size in current dir
cd /
for i in $( ls ); do
sudo du -sh $i
done
description "Puma Background Worker"
start on runlevel [2345]
stop on runlevel [06]
respawn
respawn limit 3 30
setuid j3ck
setgid j3ck
description "Sidekiq Background Worker"
start on runlevel [2345]
stop on runlevel [06]
respawn
respawn limit 3 30
normal exit 0 TERM
#reload signal USR1
kill timeout 15
def fib(n)
(2..n).inject( [0, 1] ) { |fib| fib << fib.last(2).reduce(:+) }[n]
end