Skip to content

Instantly share code, notes, and snippets.

View lopesivan's full-sized avatar
🚧
Working from home

Mr. Ivan lopesivan

🚧
Working from home
View GitHub Profile
deploy_user = node[:deploy][:user]
deploy_user_home = File.join('/', 'home', deploy_user)
rvm_version = "head"
execute "install_rvm_for_deploy_user" do
user deploy_user
command "curl -L https://get.rvm.io | bash -s #{rvm_version}"
environment "HOME" => deploy_user_home
creates "#{deploy_user_home}/.rvm"
end
require 'openssl'
require 'base64'
require 'securerandom'
def hash_hostname(hostname, salt_b64=nil)
if salt_b64
salt = Base64.decode64(salt_b64)
else
salt = SecureRandom.random_bytes(20)
salt_b64 = Base64.encode64(salt).strip
curl -XPUT 'http://localhost:9200/_template/template_logstash/' -d '
{
"template": "logstash-*",
"settings": {
"index.cache.field.type" : "soft",
"index.refresh_interval" : "5s",
"index.store.compress.stored" : true,
"index.store.compress.tv" : true,
"index.query.default_field" : "@message"
},
# This config requires the HTTP Auth Request module
# http://mdounin.ru/hg/ngx_http_auth_request_module/
set $chiliproject_key "supersecret";
# set write permission to commit_access
set $chiliproject_permission "commit_access"
location ~ "^/sys/projects/[^/]/auth(/.*)?" {
# Clean up the request to please the http_auth_request module.

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

YouTube 1080p Downloader

The Problem

It used to be you could directly download any YouTube video in any quality you wanted, as a single .mp4 file. However, around a year ago, YouTube switched from the "single file stream", to "DASH" streaming, which streams the video and the audio to you as two separate streams, which are played in sync with each other in the YouTube player.

It's still possible to download YouTube videos as a single file, but YouTube only offers that for qualities up to 720p. So you can't download "single file stream" videos in 1080p or higher.

Deploying a Rails 3 App with EC2 + S3 + Ubuntu + Capistrano + Passenger
=======================================================================
EC2 Setup
---------
1 Launch New ec2 instance - ami-1634de7f
2 Create elastic IP [ELASTIC_IP] and associate it with instance
3 go to domain registrar DNS settings, @ and www to ELASTIC_IP
4 set the `:host` in `config/deploy.rb` to ELASTIC_IP
; Sample supervisor config file.
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; sockef file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default
@lopesivan
lopesivan / .gitignore
Last active August 29, 2015 14:10 — forked from kogakure/.gitignore
*.aux
*.glo
*.idx
*.log
*.toc
*.ist
*.acn
*.acr
*.alg
*.bbl
#
# Jekyll Generator for SCSS
#
# (File paths in this description relative to jekyll project root directory)
# Place this file in ./_plugins
# Place .scss files in ./_scss
# Compiles .scss files in ./_scss to .css files in whatever directory you indicated in your config
# Config file placed in ./_sass/config.rb
require 'compass'