Skip to content

Instantly share code, notes, and snippets.

Avatar
🍻
Ewiger Feierabend

Henne Vogelsang hennevogel

🍻
Ewiger Feierabend
View GitHub Profile
@hennevogel
hennevogel / ESADO.v2.md
Last active Jul 20, 2017 — forked from mdeniz/ESADO.md
Event System Architectural Design Options
View comparison_table.md
  • Approach A: Remove Events table, every time something happens schedule a mulitpurpose job.
  • Approach B: Remove Events table, every time something happens schedule multiple single purpose jobs.
. Both solutions Approach A Approach B
Pro No No duplication of event data. Makes the events table redundant - we can easily get rid of the table and use the Event classes as POROs
Pro Failures and retries can be handled by delayed job. . No need to check when events can be deleted
Pro Failed jobs can be re-run manually . No hacking of delayed job gem required
Pro Individual queues would not be necessary . .
. . . .
View pam_mount.conf.xml
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE pam_mount SYSTEM "pam_mount.conf.xml.dtd">
<!--
See pam_mount.conf(5) for a description.
-->
<pam_mount>
<!-- debug should come before everything else,
since this file is still processed in a single pass
View gist:7b53e19b6a074b604111cfe462853ff7
umount /home
cryptsetup luksFormat /dev/sdb6
# choose the same password as for your login on this machine
cryptsetup luksOpen /dev/sdb6 home_crypto
mkfs.ext4 /dev/mapper/home_crypto
mount /dev/mapper/home_crypto /home
mv /home_new /home
# login again and come back to IRC :-)
View gist:5467e051692c180a357e575f85f008c3
RSpec.feature "Blah", :type => :feature do
context "blubb" do
describe "blabber" do
it 'does something' do
...
end
end
end
View forbidden_project_ids.rb
# this is to speed up secure Project.find
def self.forbidden_project_ids
# Admins don't have forbidden projects
return [0] if User.current && User.current.is_admin?
# This will cache and return an array:
# [ Project1_id, Project2_id, Project3_id ]
forbidden_projects = Rails.cache.fetch('forbidden_projects') do
# We use project_user_cache to calculate this...
Rails.cache.delete('allowed_forbidden_projects_by_user')
View omg.rb
def get_build_flags
build_flags = Hash.new
build_flags['all'] = Array.new
flag = main_object.flags.with_repositories(nil).with_architectures(nil).first
if flag
build_flags['all'] << flag
else
build_flags['all'] << main_object.flags.new( flag: 'build', status: Flag.default_state('build') )
end
View constraints2.diff
diff --git a/src/api/config/routes.rb b/src/api/config/routes.rb
index 66861c4..7383057 100644
--- a/src/api/config/routes.rb
+++ b/src/api/config/routes.rb
@@ -263,7 +263,7 @@ OBSApi::Application.routes.draw do
post 'user/register' => :register
get 'user/register_user' => :register_user
- get 'user/login' => :login
+ get 'user/login' => :login, constraints: cons
View constraints.diff
diff --git a/src/api/config/routes.rb b/src/api/config/routes.rb
index 66861c4..3127aea 100644
--- a/src/api/config/routes.rb
+++ b/src/api/config/routes.rb
@@ -281,7 +281,7 @@ OBSApi::Application.routes.draw do
get 'user/autocomplete' => :autocomplete
get 'user/tokens' => :tokens
- post 'user/do_login' => :do_login
+ post 'user/do_login' => :do_login, constraints: cons
View 01_monkey.rb
module ActiveRecord
module Scoping
class ScopeRegistry # :nodoc:
def self.value_for(scope_type, variable_name)
instance.value_for(scope_type, variable_name)
end
def self.set_value_for(scope_type, variable_name, value)
instance.set_value_for(scope_type, variable_name, value)