Skip to content

Instantly share code, notes, and snippets.

View agarie's full-sized avatar

Carlos Agarie agarie

View GitHub Profile
@mislav
mislav / json2csv.rb
Created October 5, 2009 13:47
Dump Twitter followers to JSON or CSV
# Usage:
# ruby -rubygems json2csv.rb my-dump.json > people.csv
#
require 'json'; require 'csv'
FIELDS = %w(id screen_name name friends_count followers_count)
data = JSON.load ARGF
csv = CSV::Writer.create(STDOUT)
data.each { |user| csv << FIELDS.map { |f| user[f] } }
@uhlenbrock
uhlenbrock / deploy.rb
Created January 25, 2010 21:47
Simple Capistrano recipe for Jekyll
set :application, 'foo'
set :repository, '_site'
set :scm, :none
set :deploy_via, :copy
set :copy_compression, :gzip
set :use_sudo, false
set :host, '127.0.0.1'
role :web, host
role :app, host
@jasongraham
jasongraham / less_converter.rb
Created October 22, 2010 04:14
A Jekyll plugin to convert a .less file to .css
module Jekyll
# Compiled LESS CSS into CSS. You must specify an empty YAML front matter
# at the beginning of the file.
# .less -> .css
class LessConverter < Converter
safe true
priority :low
pygments_prefix "\n"
pygments_suffix "\n"
@expandrive
expandrive / prettyjson
Created December 7, 2010 20:39
Take JSON from stdin and dump it to stdout in a more readable form
#!/usr/bin/python
# From http://stackoverflow.com/questions/352098/how-to-pretty-print-json-script
# To install paste this into a file named prettyjson that lives in your PATH
# e.g.
# sudo touch /usr/bin/prettyjson
# sudo open -t /usr/bin/prettyjson
# paste this file and save
# sudo chmod +x /usr/bin/prettyjson
"""
@jessykate
jessykate / Jekyll nd Octopress Liquid tag for MathJax.rb
Created February 18, 2011 23:37
A simple liquid tag for Jekyll/Octopress that converts {% m %} and {% em %} into inline math, and {% math %} and {% endmath %} into block equations, by replacing with the appropriate MathJax script tags.
module Jekyll
class MathJaxBlockTag < Liquid::Tag
def render(context)
'<script type="math/tex; mode=display">'
end
end
class MathJaxInlineTag < Liquid::Tag
def render(context)
'<script type="math/tex">'
end
@lorn
lorn / stopwords.txt
Created May 27, 2011 16:21
pt-br stopwords
"abaixo", "aca", "acaso",
"acerca", "acima", "acola", "acula", "ademais", "adentro",
"adiante", "afinal", "afora", "agora", "agorinha", "ah", "ainda",
"alem", "algo", "alguem", "algum", "alguma", "algumas", "alguns",
"ali", "alias", "alo", "ambos", "amiude", "ante", "antes", "ao",
"aonde", "aos", "apenas", "apesar", "apos", "apud", "aquela",
"aquelas", "aquele", "aqueles", "aqui", "aquilo", "as", "assim",
"ate", "atras", "atraves", "basicamente", "bastante", "bastantes",
"bem", "bis", "bom", "ca", "cada", "cade", "caso", "certa",
"certamente", "certas", "certeiramente", "certo", "certos", "chez",
@nelstrom
nelstrom / vim-plugin-directories
Created June 30, 2011 11:32
An overview of what belongs in each directory of a Vim plugin.
plugin
naming convention: name_of_plugin.vim
these files are sourced for all file types
doc
naming convention: name_of_plugin.txt
these files document the functionality of a plugin
color
naming convention: name_of_colorscheme.vim
@phollyer
phollyer / spreadsheet_test
Created September 13, 2011 17:43
Spreadsheet Gem - updating an existing sheet without changing the output location or filename
#!/usr/bin/env ruby
require 'spreadsheet'
# Begin Test
print "Spreadsheet Test\n"
# Create the rows to be inserted
row_1 = ['A1', 'B1']
row_2 = ['A2', 'B2']
@jhwilson
jhwilson / jhwhw.cls
Created October 11, 2011 16:25
JHW document class for Homework assignments
%=====================================================================
% jhwhw.cls
% Provide jhwhw.cls class
%=====================================================================
%=====================================================================
% Identification
%=====================================================================
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{jhwhw}[2009/02/11 Justin Wilson's Homework Class]
@metaphox
metaphox / gist:1644401
Created January 20, 2012 01:34
Fixing the postgresql initdb fatal shared memory error on Leopard
Fixing the postgresql initdb fatal shared memory error on Leopard
Published Tue 18 December 2007 11:09 (+1300)
Tagged
software (43 posts and 3 photos)
mac os x (6 posts)
When doing the post-install setup of postgresql default database using initdb, you may hit this error:
FATAL: could not create shared memory segment: Cannot allocate memory
DETAIL: Failed system call was shmget(key=1, size=1646592, 03600).