Skip to content

Instantly share code, notes, and snippets.

View javereec's full-sized avatar

Jan Vereecken javereec

View GitHub Profile
@javereec
javereec / db_server.rb
Created February 29, 2012 13:38 — forked from coderanger/db_server.rb
Create postgres users and databases from Chef
#
# Cookbook Name:: atari
# Recipe:: db_server
#
# Copyright 2010, Atari
#
# All rights reserved
#
include_recipe "postgresql::server"
@javereec
javereec / gist:2662162
Created May 11, 2012 20:11
Installing Spree on OSX 10.7
# Install rvm
# Install ruby 1.9.3-p125
rvm install 1.9.3-p125 --with-gcc=clang
@javereec
javereec / sort_hash.rb
Created March 20, 2013 07:41
Script that can be used to sort a YAML file. Primary use would be to deep sort locale files. The output is the originally filename with "sorted" as a prefix.
require 'active_support'
require 'YAML'
# in some cases i've found JSON.pretty_generate doesn't output properly
# when combined with ActiveSupport::OrderedHash without json/pure
# require 'json/pure'
def returning(value)
yield(value)
value
end
@javereec
javereec / gist:8770989
Created February 2, 2014 16:33
elasticsearch
curl -XDELETE localhost:9200/twitter
curl -XPOST localhost:9200/twitter -d '
{"index":
{ "number_of_shards": 1,
"analysis": {
"filter": {
"snowball": {
"type" : "snowball",
"language" : "English"
@javereec
javereec / gist:592814e76a6f9f95b40e
Created February 7, 2015 19:53
File upload spree api
conn = Faraday.new(url: 'http://veran.lvh.me:3000/', params: { token: 'ac350077d3066be3d2ca79fd0586e1b1d386b88a5870a1c0' }) do |f|
f.request :multipart
f.request :url_encoded
f.adapter :net_http
end
response = conn.post('api/products/abacate-embalagem-de-1kg/images',{image: {attachment: Faraday::UploadIO.new('./image.jpg', 'image/jpeg')}})
##
@javereec
javereec / filter
Last active August 29, 2015 14:22 — forked from hofrob/filter
filter {
if [type] == "odoo" {
grok {
match => { "message" => "%{ODOOLOG}" }
}
date {
match => [ "timestamp", "yyyy-MM-dd HH:mm:ss,SSS" ]
}
}
}
@javereec
javereec / form.jsx
Last active August 29, 2015 14:27 — forked from syllog1sm/form.jsx
react-bootstrap Form component
/** @jsx React.DOM */
import React from './react-es6';
import classSet from './react-es6/lib/cx';
import BootstrapMixin from './BootstrapMixin';
var Form = React.createClass({
mixins: [BootstrapMixin],
# Create a product
product_params = %{
description: "some content",
name: "some content",
price: 120.5,
sku: "ABC-123"
}
{:ok, product} = Nova.ProductCommands.create(product_params)
# Create a variant
@javereec
javereec / .wakeup
Created February 15, 2017 19:44 — forked from ralph089/.wakeup
Restarts Bluetooth Module on Mac OS X El Capitan. You can use the script as shortcut to restart Bluetooth on demand or you can use it with "SleepWatcher" to automatically restart Bluetooth on wakeup (See README.md). I created it, because my Logitech Bluetooth Mouse doesn't stay connected after sleep-mode, so i had to manually re-pair my mouse.
#!/bin/bash
#
# Restart Bluetooth Module on Mac OS X
#
# Requires Blueutil to be installed: http://brewformulas.org/blueutil
BT="/usr/local/bin/blueutil"
log() {
echo "$@"

Keybase proof

I hereby claim:

  • I am javereec on github.
  • I am javereec (https://keybase.io/javereec) on keybase.
  • I have a public key ASAdAsFp3Rp7_-bLDyeD8QD07cEnabw40jhBiT5iF1u1lwo

To claim this, I am signing this object: