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
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
Acme Envy
I love having the latest versions of Perl, Python, and Ruby at my disposal. For some time now I've been managing my Perl installations with perlbrew, my Python installations with pythonbrew, and my Ruby installations with rvm. They all work fine and I continue to manage my desktop machine this way.
But a while back, I tried rbenv on my laptop. It worked great! Just clone the repositories
$ git clone git://github.com/sstephenson/rbenv.git .rbenv
$ git clone git://github.com/sstephenson/ruby-build.git \
~/.rbenv/plugins/ruby-build
initialize in your shell
@lopesivan
lopesivan / gist:6123f828ef71aa523ffd
Last active August 29, 2015 14:06
Python pip search
pip search . | egrep -B1 'INSTALLED|LATEST'
pip - A tool for installing and managing Python packages.
INSTALLED: 1.5.4
LATEST: 1.5.6
--
Pygments - Pygments is a syntax highlighting package written in Python.
INSTALLED: 1.6 (latest)
--
Jinja2 - A small but fast and easy to use stand-alone template engine written in pure python.
; 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 / gist:f15d6138c9d643e1a0c9
Created September 16, 2014 16:20
configurando default browser
sudo update-alternatives --config x-www-browser
sudo update-alternatives --config gnome-www-browser
@lopesivan
lopesivan / README.md
Last active August 29, 2015 14:07
Out of band syncing to a local git branch.

git-snapshot

Out of band syncing to a local git branch.

This started as an experiment to see how commits could be created without modifying the working directory, the index, or the state of HEAD. The end result is like a cross between rsync and git stash using a specified branch.

Benefits