Skip to content

Instantly share code, notes, and snippets.

View mlankenau's full-sized avatar

Marcus Lankenau mlankenau

  • SLL Automotive Group GmbH
  • Erika-Mann-Straße 63, 80636 München
View GitHub Profile
@mlankenau
mlankenau / install_capybary_webkit.sh
Created August 18, 2012 10:17
Install capybara-webkit on Ubuntu 1104
sudo apt-get install libqt4-dev xvfb
sudo gem install capybara-webkit
@mlankenau
mlankenau / shell_setup
Created August 25, 2012 08:12
My (shell) setup
# git alias
git config alias.st status
# tool I need
apt-get install gitg
@mlankenau
mlankenau / vagrant_box_url
Created September 2, 2012 08:48
list of vagrant boxes
http://www.vagrantbox.es/
@mlankenau
mlankenau / gist:5014829
Created February 22, 2013 16:48
ActiveSupport::Convern
module Bar
extend ActiveSupport::Concern
include Foo
included do
self.method_injected_by_foo
end
end
@mlankenau
mlankenau / profile.py
Created July 10, 2014 09:15
FreeCAD create airfoil
from __future__ import division # allows floating point division from integers
import FreeCAD, Part, math
from FreeCAD import Base
class ProfileShape:
def __init__(self, obj):
''' Add the properties: Radius, Eccentricity, Height, Segments (see Property View) '''
obj.addProperty("App::PropertyLength","Length","Airfoil","Forward pos").Length=100.0
obj.addProperty("App::PropertyFloat","XPos","Airfoil","Sideways pos").XPos=0.0
obj.addProperty("App::PropertyFloat","YPos","Airfoil","Forward pos").YPos=0.0
@mlankenau
mlankenau / gist:1b49a6812c4a9ed99ab7
Created June 26, 2015 06:32
ruby script that is searching for invalid url/path helper in an rails project
#
# script is searching for all the url and path helpers that does not exist
#
search_result = `egrep -o -r "([a-z][a-z]+_){2,10}(path|url)" app`
routes = `rake routes`
def without_path(name)
name.split('_')[0..-2].join('_')
end
helpers = search_result.split("\n").map { |l| l.split(':').last}.compact.uniq
valid_names = routes.split("\n").map { |l| (l =~ /^\s*([a-z_]+)\s*[A-Z\|]+/) ? $1 : nil }.compact
require 'benchmark'
def split(array)
middle = array.length / 2
[array[0..(middle-1)], array[middle..-1]]
end
def merge(a, b)
i = j = 0
result = []
require 'matrix'
require 'byebug'
require 'rspec'
include Math
def sqr(x)
x * x
end
@mlankenau
mlankenau / install_arduino.sh
Created September 28, 2015 07:11
Getting arduino to work on ubuntu without running as root
# install arduino ide
sudo apt-get update && sudo apt-get install arduino arduino-core
# necessary to get into dialup group (at least for me), maybe reboot afterwards
sudo apt-get remove modemmanager
# add user to the dialout group
sudo usermod -a -G dialout <my-username>
# arduino should work now without beeing root
prims = Stream.unfold({2, []}, fn {next, list} -> if(Enum.any?(list, &(rem(next, &1) == 0)), do: {nil, {next+1, list}}, else: {next, {next+1, [next|list]}}) end)