Skip to content

Instantly share code, notes, and snippets.

View sergiocampama's full-sized avatar
🇨🇱

Sergio Campamá sergiocampama

🇨🇱
View GitHub Profile
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sqlite3'
GEMFILE
system 'bundle install'
end
@sergiocampama
sergiocampama / mobile-meta-links.html
Created December 3, 2011 21:02
iOS Web App Configuration
@sergiocampama
sergiocampama / benchmark.c
Created March 12, 2012 02:00
Benchmark for measuring a computer performance written in C. Based in matrix inversion algorithms from 'Recipes in C', with number of retries and matrix size configurables.
//Sergio Campamá 11-3-2012
//sergiocampama@gmail.com
//Numerical functions taken from the book 'Recipes in C'
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
@sergiocampama
sergiocampama / jquery.mstch_tmpl.js
Created September 5, 2012 19:53
jQuery Mustache Templating Function
(function( $ ){
$.fn.mstch_tmpl = function(template, object) {
var that = this;
var template_string;
//Check if template is a string or a jQuert object
if (typeof(template)=='string' && isNaN(template)) {
template_string = template;
} else if (template instanceof jQuery){
template_string = template.html();
@sergiocampama
sergiocampama / gist:3922453
Created October 20, 2012 07:10 — forked from jrochkind/gist:2161449
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

@sergiocampama
sergiocampama / rut.rb
Created June 21, 2013 14:27
Ruby class extensions for Chilean RUTs
class Fixnum
def to_rut
digits = self.to_s.to_rut
end
end
class String
def to_rut
count = -1
sum = self.each_char.to_a.map(&:to_i).reverse.
@sergiocampama
sergiocampama / install.sh
Created November 7, 2012 19:33
Postgresql 9.2.1 Installation instructions for Ubuntu 12.04
#Postgresql 9.2.1 Compilation instructions for Ubuntu 12.04
#This will install Postgresql 9.2.1 into /usr/local/postgresql-9.2.1
#This assumes that you have sudo provileges on the machine installing postgresql
#It should work by copying and pasting into the shell, I haven't tested it, I just summarized
#what I just did and it worked
#Get requirements
sudo apt-get install build-essential libreadline6-dev zlib1g-dev
@sergiocampama
sergiocampama / tcp_server.rb
Created February 20, 2012 19:55
Ruby TCP Server
require 'socket'
server = TCPServer.open(3010) # Socket to listen on port
loop do # Servers run forever
Thread.start(server.accept) do |client|
puts "client connected"
#do stuff
end
end
@sergiocampama
sergiocampama / Output
Last active July 19, 2018 03:48
Error with static linking
Hello, world!
*** Error in `./Hello': free(): invalid pointer: 0x00007ff6db7ca760 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7ff6d99637e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7ff6d996c37a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7ff6d997053c]
/usr/lib/x86_64-linux-gnu/libp11-kit.so.0(+0x3fd6d)[0x7ff6d48fad6d]
/lib64/ld-linux-x86-64.so.2(+0x10de7)[0x7ff6db5d2de7]
/lib/x86_64-linux-gnu/libc.so.6(+0x39ff8)[0x7ff6d9925ff8]
/lib/x86_64-linux-gnu/libc.so.6(+0x3a045)[0x7ff6d9926045]
@sergiocampama
sergiocampama / README.md
Last active June 24, 2022 18:04
Google Spreadsheet Cryptoscrypt

Google Spreadsheet Cryptoscrypt

Google Spreadsheet scripts for Coinbase and USD/BTC and USD/other currencies.

If you found this useful, donate XMR!: 44WvZj9zRXqgq3jHpemt8dLt29aDRQqdiK6ivxoCf3e65cdXbzBnHJyc2CdGWeGr36f5MBkqQBb61hus34nUVae4ND2PKx4

Made with love from Chile