Skip to content

Instantly share code, notes, and snippets.

View matiasgarciaisaia's full-sized avatar
🙃
Piensa bonito

Matías García Isaía matiasgarciaisaia

🙃
Piensa bonito
View GitHub Profile
@matiasgarciaisaia
matiasgarciaisaia / hg-to-git.sh
Created October 9, 2013 15:49
A script for migrating a Mercurial repository to a new git one
#!/bin/bash
function abort() {
echo "ERROR: $1"
echo ""
echo "USAGE: $0 /path/to/hg/repo /path/to/new/repo"
exit 1
}
[ $# -eq 2 ] || abort "Invalid parameters count"
[ -d $1 ] || abort "$1 should be an existing hg repository"
@matiasgarciaisaia
matiasgarciaisaia / gist:6903934
Created October 9, 2013 16:21
hg-to-git.sh sample usage
$ cat my/repository/.hg/branch
default
$ curl https://gist.github.com/matiasgarciaisaia/6903416/raw/hg-to-git.sh -o hg-to-git.sh
$ chmod +x hg-to-git.sh
$ [ -d new-repository ] || echo "new-repository does not exist"
new-repository does not exist
$ ./hg-to-git.sh my/repository/ new-repository
## [ ... tons of output ... ]
$ cd new-repository
$ git branch | grep \*
@matiasgarciaisaia
matiasgarciaisaia / pre-commit
Created January 29, 2014 21:11
A simple hook to prevent commits adding Ruby string interpolations in single quotes, that will fail
#!/bin/sh
#
# A simple hook to prevent commits adding Ruby string interpolations
# in single quotes, that will fail.
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
$ node server.js
binding SSDP to port 2503
discovering all IPs from lo0
discovering all IPs from en1
discovering all IPs from vboxnet1
relevant IPs { '192.168.0.130': null, '192.168.59.3': null }
no settings file found, will only use default settings
notification server listening on port 3500
no preset file, ignoring...
http server listening on port 5005
@matiasgarciaisaia
matiasgarciaisaia / search.js
Created October 21, 2015 18:53
Autocomplete-enabled search box for a Middleman static site using middleman-search extension and jquery-ui
var lunrIndex = null;
var lunrData = null;
// Download index data
$.ajax({
url: '/index.json',
cache: true,
method: 'GET',
success: function(data) {
lunrData = data;
@matiasgarciaisaia
matiasgarciaisaia / bundle_install_--verbose.log
Created November 12, 2015 01:20
bundle install --verbose
HTTP GET http://bundler.rubygems.org/api/v1/dependencies
HTTP 200 OK
Fetching gem metadata from http://rubygems.org/
Query List: ["middleman", "middleman-livereload", "middleman-blog", "middleman-blog-drafts", "builder", "nokogiri", "wdm", "middleman-s3_sync", "middleman-build-reporter", "pry-debugger", "middleman-alias", "middleman-sitemap", "middleman-sitemap-ping", "middleman-syntax", "redcarpet", "ruby18_source_location", "inifile", "middleman-search"]
Query Gemcutter Dependency Endpoint API: middleman,middleman-livereload,middleman-blog,middleman-blog-drafts,builder,nokogiri,wdm,middleman-s3_sync,middleman-build-reporter,pry-debugger,middleman-alias,middleman-sitemap,middleman-sitemap-ping,middleman-syntax,redcarpet,ruby18_source_location,inifile,middleman-search
HTTP GET http://bundler.rubygems.org/api/v1/dependencies?gems=middleman,middleman-livereload,middleman-blog,middleman-blog-drafts,builder,nokogiri,wdm,middleman-s3_sync,middleman-build-reporter,pry-debugger,middleman-alias,middleman-sitemap,midd
#!/usr/bin/env ruby
require 'sinatra'
require 'tempfile'
set :bind, '0.0.0.0'
get '/' do
source_url = params['q']
puts "Downloading #{source_url} ..."
system("wget -nc #{source_url}")
@matiasgarciaisaia
matiasgarciaisaia / Dockerfile
Created September 28, 2016 16:33
Sample Crystal Dockerfile
FROM crystallang/crystal:0.19.2
# Install crystal deps
ADD shard.yml /app/
ADD shard.lock /app/
WORKDIR /app
RUN crystal deps
# Add app and build it
ADD . /app
@matiasgarciaisaia
matiasgarciaisaia / crystal-fail.txt
Created November 10, 2016 19:29
sudo apt-get install crystal fails on standard Bash on Ubuntu/Win10
user@MSEDGEWIN10:/mnt/c/Windows/System32$ sudo apt-get install crystal
sudo: unable to resolve host MSEDGEWIN10
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfreetype6 os-prober
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
@matiasgarciaisaia
matiasgarciaisaia / crystal-fail.txt
Created November 10, 2016 19:29
sudo apt-get install crystal fails on standard Bash on Ubuntu/Win10
user@MSEDGEWIN10:/mnt/c/Windows/System32$ sudo apt-get install crystal
sudo: unable to resolve host MSEDGEWIN10
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfreetype6 os-prober
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed: