Skip to content

Instantly share code, notes, and snippets.

@choallin
choallin / Main.sublime-menu
Created October 27, 2014 08:26
Sublime configuration
[{
"id": "view",
"children": [{
"id": "layout",
"children": [
{
"command": "set_layout",
"caption" : "Custom: 3 Pane (2T 1B)",
"mnemonic": "C",
"args": {
@choallin
choallin / .bash_aliases
Last active July 13, 2016 11:54
ubuntu config
#du -h damit es lesbare werte ausgibt
alias du='du -h'
#update check kürzer
alias agu='sudo apt-get update'
#install kürzer
alias agi='sudo apt-get install'
#upgrade
@choallin
choallin / .spacemacs
Last active February 22, 2018 11:51
My spacemacs configuration
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
case interface_typ
when "HL7"
case interface_version
when "2.3.1"
Hl7Helper.hl7_2_3_1_export_lab @@actual_konfig_interface
else
# Do some stuff
end
when "GDT"
case interface_version
class InterfaceController < ApplicationController
def interface_defintion
{
"HL7" => {
"Version_2_3" => Services::Interfaces::HL7::Version_2_3.new
},
"GDT" => {
"Version_2_1" => Services::Interfaces::GDT::Version_2_1.new
},
@choallin
choallin / deadlock_mutex.rb
Created June 18, 2019 16:03
Deadlock by mutex
mutext_resource_a = Mutex.new
mutext_resource_b = Mutex.new
resource_a = []
resource_b = []
threads = []
threads << Thread.new do |t|
# The number is on purpose so high, so that it will create
# a deadlock in your irb as well
resource_a = []
threads = []
threads << Thread.new do |t|
50.times do |i|
resource_a << i
end
end
threads << Thread.new do |t|
class DoorLock
def initialize(locked)
@locked = locked
end
def open?
!@locked
end
def unlock!
4.times.map do
t = Thread.current
t["#{dynamic_variable_name}".to_sym] = method_call
end
joined_threads = threads.map &:join
joined_threads.each do |t|
# The keys method returns all thread local variables by names
# analog to the Hash#keys method
t.keys.each do |key|
class DoorLock
def initialize(locked)
@locked = locked
@mutex = Mutex.new
end
def open?
@mutex.synchronize { !@locked }
end