Skip to content

Instantly share code, notes, and snippets.

View namxam's full-sized avatar

Maximilian Schulz namxam

View GitHub Profile
@namxam
namxam / gist:970361
Created May 13, 2011 11:11
typhoeus example
require 'rubygems'
require 'typhoeus'
hydra = Typhoeus::Hydra.new
# Create all your requests
request = Typhoeus::Request.new("http://your_image_url")
request.on_complete do |response|
# Check if the returned data really is an image
@namxam
namxam / output.json
Created January 31, 2012 00:26
neo4j cypher collect issue
// start CategoryRoot=node(258) match CategoryRoot<-[:model_type]-Category<-[:InstrumentCategorization]-Instrument return Category, collect(Instrument)
{
"data": [
[{
"outgoing_relationships": "http://localhost:7477/db/data/node/259/relationships/out",
"data": {
"name_en": "Wind instruments",
"architect4r_type": "InstrumentCategory",
@namxam
namxam / gist:4259327
Created December 11, 2012 15:26 — forked from stephanpavlovic/gist:4259284
domain spec
#require 'spec_helper'
#require_relative '../../../app/domain/geocoder_wrapper'
require 'rspec/autorun'
class GeocodeWrapper
def self.geocode(name)
0
#Geocoder.search(name)
end
description "Your App"
author "Maximilian Schulz <m.schulz@kulturfluss.de>"
# Define when to run the app
start on (local-filesystems and runlevel [2345])
stop on runlevel [016]
# Default config
respawn
respawn limit 10 5
require 'smartcard'
#UID_CMD = "\xFF\xCA\x00\x00\x00"
UID_CMD = "\xFF\xCA\x00\x00\x00"
def format_readable(sequence)
sequence.to_s.unpack('C*').join
end
stop = false
@namxam
namxam / gist:9369104
Created March 5, 2014 15:11
Railslove Theme for Mou.app
html {
background-color: #32b93c;
padding: 60px 30px;
}
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
class FakeService
def self.call(env)
[200, { 'Content-Type' => 'application/json' }, ['{ "name": "John Doe" }']]
end
end
@namxam
namxam / gist:11173219
Created April 22, 2014 10:22
RSA with PKCS encryption and Mavericks support
# Create a rsa key with 4096 bit encryption. This is far more secure than 2048.
# The email is just a plain comment. Make sure you enter a passphrase!
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
# The basic passphrase security is rather bad and easy to break. Read the following article why:
# http://martin.kleppmann.com/2013/05/24/improving-security-of-ssh-private-keys.html
mv id_rsa id_rsa.old
openssl pkcs8 -topk8 -v2 des3 -in ~/.ssh/id_rsa.old -out ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
@namxam
namxam / gist:11184038
Created April 22, 2014 15:39
Ruby 2.1 app docker config
server {
server_name localhost;
listen 80;
root /home/app/webapp/public;
passenger_enabled on;
passenger_user app;
passenger_ruby /usr/bin/ruby2.1;
}
@namxam
namxam / template.rb
Last active August 29, 2015 14:01
ElasticSearch Template
# $ rails new searchapp --skip --skip-bundle --template https://raw.github.com/elasticsearch/elasticsearch-rails/master/elasticsearch-rails/lib/rails/templates/03-complex.rb
# (See: 01-basic.rb, 02-pretty.rb)
append_to_file 'README.rdoc', <<-README
== [3] Expert
The `expert` template changes to a complex database schema with model relationships: article belongs
to a category, has many authors and comments.