Skip to content

Instantly share code, notes, and snippets.

View CarlosEspejo's full-sized avatar
🖖

Carlos Espejo CarlosEspejo

🖖
View GitHub Profile

Systemd

sample.service file you have to copy it to /etc/systemd/system

Set it to auto start

sudo systemctl enable sample.service

Troubleshoot

@CarlosEspejo
CarlosEspejo / pg_backup.sh
Last active December 18, 2015 05:55
Postgresql 30 day backup script
#!/bin/bash
# This script will create a compressed data dump
# that can be restored in parallel using
# pg_restore -C -j[num of cores] -d postgres 2015-09-30-app_db.dump
# note: when -C is present the db in -d is used only to make the connection.
# http://www.postgresql.org/docs/current/static/app-pgrestore.html
# http://www.postgresql.org/docs/current/static/app-pgdump.html
DATABASE_NAME=app_db
@CarlosEspejo
CarlosEspejo / PG Tuning
Last active October 13, 2015 16:14
Postgres Modern Tuning settings
# Borrowed from this talk
# https://www.youtube.com/watch?v=dBeXS5aFLNc
# http://jberkus.github.io/performance_in_15_min/index.html?utm_source=postgresweekly&utm_medium=email#37
# Thank you Josh!!
# Memory Settings
shared_buffers = 2GB # RAM/4 up to 8GB
work_mem = 32MB # limit: RAM/(max_connections/2)
# 8MB to 32MB: web
@CarlosEspejo
CarlosEspejo / encoder.rb
Last active January 25, 2016 12:26
Ruby Transcoder
require 'fileutils'
class Encoder
attr_reader :processed, :search_path, :queue
def initialize
@search_path = '/mnt/data/media'
@processed = File.readlines('encode.log') if File.exists?('encode.log')
@processed = Array(processed).map(&:chomp)
@queue = Dir.glob("#{search_path}/**/*.avi").sort

Keybase proof

I hereby claim:

  • I am carlosespejo on github.
  • I am awcarlos (https://keybase.io/awcarlos) on keybase.
  • I have a public key ASC2JMFchy46ahF4d2Vnp6L4kTL2IplOUR0BaJTFzaM7fAo

To claim this, I am signing this object: