Skip to content

Instantly share code, notes, and snippets.

View malev's full-sized avatar

Marcos Vanetta malev

View GitHub Profile
@malev
malev / addresses_matcher.py
Created April 15, 2014 22:02
Addresses matcher
import sys
import time
import csv
class AddressesFinder:
def __init__(self, addresses):
self.addresses = addresses
def call(self):
output = []
@malev
malev / generalize.rb
Created March 31, 2014 21:08
Generalize
require 'csv'
require 'json'
require 'uri'
require 'ostruct'
require 'httparty'
require 'progressbar'
require 'people'
class OutputCSV
attr_reader :filename
@malev
malev / convert.sh
Last active August 29, 2015 13:56
Convert encoding
for file in *.txt; do
iconv -f ISO-8859-1 -t utf-8 "$file" > "${file%.txt}.utf8.txt"
done
@malev
malev / mycoolblog.conf
Created April 13, 2012 04:57
Nginx conf file
server {
listen 80;
server_name *.mycoolblog.com mycoolblog.com www.mycoolblog.com;
root /home/malev/blog/current/;
try_files $uri $uri/ /index.php;
location / {
index index.html index.htm index.php;
}
@malev
malev / php5-fcgi
Created April 13, 2012 04:49
/etc/init.d/php5-fcgi
#!/bin/sh
PHP_SCRIPT=/usr/bin/php5-fcgi
RETVAL=0
case "$1" in
start)
echo "Starting fastcgi"
$PHP_SCRIPT
RETVAL=$?
;;
stop)
@malev
malev / infofund.conf
Created April 8, 2012 19:36
nginx.conf file for a virtual host
server {
listen 80;
server_name example.com www.example.com;
root /home/malev/sites/infofund/current/public;
access_log /home/malev/sites/infofund/current/log/infofund.access.log;
error_log /home/malev/sites/infofund/current/log/infofund.error.log;
rewrite_log on;
passenger_enabled on;
}
@malev
malev / gist:1967260
Created March 3, 2012 18:22
3rd Mustache example
<script type='text/html' id='template'>
<div class='description'>{{#truncate}}{{item.description}}{{/truncate}}</div>
</script>
@malev
malev / gist:1967225
Created March 3, 2012 18:18
2nd mustach example
var helpers = {
truncate: function (str) {
if (str.length > 400) {
return str.slice(0, 400) + "...";
} else {
return str;
}
}
}
var template = "<div class='description'>{{#truncate}}{{item.description}}{{/truncate}}</div>";
@malev
malev / gist:1967208
Created March 3, 2012 18:16
Mustache example
var template = "
<h1>{{header}}</h1>
{{#bug}}
{{/bug}}
{{#items}}
{{#first}}
<li><strong>{{name}}\</strong></li>
{{/first}}
{{#link}}
<li><a href="{{url}}">{{name}}</a></li>
@malev
malev / infofund.conf
Created February 26, 2012 19:27
infofund.conf
server {
listen 80;
server_name midominio.com www.midominio.com mialias.com www.mialias.com;
root /opt/nginx/html/infofund/public;
access_log /opt/nginx/html/infofund/log/infofund.access.log;
error_log /opt/nginx/html/infofund/log/infofund.error.log;
rewrite_log on;