Skip to content

Instantly share code, notes, and snippets.

View r10r's full-sized avatar

Ruben Jenster r10r

  • Drachenfels GmbH
  • Pforzheim
View GitHub Profile
@r10r
r10r / asymmetric.go
Last active August 27, 2015 19:52 — forked from cryptix/LICENSE
example of using JWT for http authentication in go
package main
// using asymmetric crypto/RSA keys
import (
"crypto/rsa"
"fmt"
"io/ioutil"
"log"
"net/http"
function WSTestCtrl($scope, ws) {
$scope.method = 'ping'
$scope.params = '[]'
$scope.reply = 'None yet.'
$scope.reply_class = 'info'
$scope.go = function(){
ws.call($scope.method, JSON.parse($scope.params)).then(function(d){
$scope.reply = JSON.stringify(d)
@r10r
r10r / jhw-assets.md
Created May 16, 2012 17:40 — forked from lamikae/jhw-assets.md
Jasmine headless testing on Rails 3 asset pipeline

Jasmine headless testing on Rails 3 asset pipeline

  • assets and specs can be CoffeeScript
  • 3rd party JS can be placed to vendor/assets/javascripts or vendor gems
  • detects gem-vendored JS via application.js require
  • uses jasmine-headless-webkit to run the suite outside the browser
    • this requires Qt4.7 installation
@r10r
r10r / "parent child" data
Created June 3, 2012 19:08 — forked from ToulBoy/"parent child" data
Elasticsearch 0.18.6 : My example of "parent child"
curl -s -XPOST localhost:9200/_bulk?pretty=true --data-binary '
{ "index" : { "_index" : "parent_child", "_type" : "store", "_id" : "store1" } }
{ "name" : "auchan", "owner" : "chris" }
{ "index" : { "_index" : "parent_child", "_type" : "department", "_id" : "department1", "parent" : "store1" } }
{ "name" : "toys", "numberOfProducts" : 150 }
{ "index" : { "_index" : "parent_child", "_type" : "product", "_id" : "product1", "parent" : "department1", "routing" : "store1" } }
{ "name" : "gun", "trademark" : "tiger", "price" : 9, "store_id" : "store1" }
'
@r10r
r10r / nginx-elasticsearch-proxy.conf
Created June 3, 2012 20:08 — forked from karmi/nginx-elasticsearch-proxy.conf
Route requests to ElasticSearch to authenticated user's own index with an Nginx reverse-proxy
# Run me with:
#
# $ nginx -p /path/to/this/file/ -c nginx.conf
#
# All requests are then routed to authenticated user's index, so
#
# GET http://user:password@localhost:8080/_search?q=*
#
# is rewritten to:
#
# ========================================
# Testing n-gram analysis in ElasticSearch
# ========================================
curl -X DELETE localhost:9200/ngram_test
curl -X PUT localhost:9200/ngram_test -d '
{
"settings" : {
"index" : {
"analysis" : {
@r10r
r10r / "parent child" data
Created June 3, 2012 22:29 — forked from ToulBoy/"parent child" data
Elasticsearch 0.20.0.Beta1-SNAPSHOT with has_parent merged : Search for childs with "has_parent"
curl -s -XPOST localhost:9200/_bulk?pretty=true --data-binary '
{ "index" : { "_index" : "parent_child", "_type" : "store", "_id" : "store1" } }
{ "name" : "auchan", "owner" : "chris" }
{ "index" : { "_index" : "parent_child", "_type" : "department", "_id" : "department1", "parent" : "store1" } }
{ "name" : "toys", "numberOfProducts" : 150 }
{ "index" : { "_index" : "parent_child", "_type" : "product", "_id" : "product1", "parent" : "department1", "routing" : "store1" } }
{ "name" : "gun", "trademark" : "tiger", "price" : 9, "store_id" : "store1" }
'
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
<html>
<body>
<p><%= @options[:title] %></p>
<%= import("chapter.html.erb") %>
</body>
</html>
@r10r
r10r / jq-cheetsheet.md
Created July 7, 2021 13:53 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq