Skip to content

Instantly share code, notes, and snippets.

View bjensen's full-sized avatar

Brian Jensen bjensen

View GitHub Profile
sudo yum update -y
sudo yum install -y openvpn
sudo yum install easy-rsa -y --enablerepo=epel
sudo cp -via /usr/share/easy-rsa/3.0 CA
sudo /usr/share/easy-rsa/3.0/easyrsa -init-pki
sudo /usr/share/easy-rsa/3.0/easyrsa build-ca nopass

Test1

Kommando eksekveret:

RAILS_ENV=production  time -f "%E real,%U user,%S sys"  bin/rails runner "Statistics::MinistryQuarterlyReport.new(ProdSchools::Xor, StayType.find([44, 486]), '2017-01-01'.to_date, '2017-03-31'.to_date, nil).get()"

På nordplaner.dk:

0:29.45 real,22.86 user,1.26 sys
/**
*
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
@bjensen
bjensen / user.rb
Created August 3, 2013 18:25 — forked from moeffju/user.rb
class User < ActiveRecord::Base
alias :devise_valid_password? :valid_password?
def valid_password?(password)
begin
devise_valid_password?(password)
rescue BCrypt::Errors::InvalidHash
return false unless Digest::SHA1.hexdigest(password) == encrypted_password
logger.info "User #{email} is using the old password hashing method, updating attribute."
self.password = password
@bjensen
bjensen / gist:5455939
Created April 24, 2013 21:57
sources.list for danish version of ubuntu 12.04.2 lts
#############################################################
################### OFFICIAL UBUNTU REPOS ###################
#############################################################
###### Ubuntu Main Repos
deb http://dk.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://dk.archive.ubuntu.com/ubuntu/ precise main restricted
###### Ubuntu Update Repos
deb http://dk.archive.ubuntu.com/ubuntu/ precise-security main restricted
@bjensen
bjensen / 0-readme.md
Created December 11, 2012 12:57 — forked from burke/0-readme.md
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@bjensen
bjensen / gist:4114045
Created November 19, 2012 21:22 — forked from rud/gist:4045605
class ToggleLogging
def self.setup
Signal.trap('USR1') do
toggle
end
end
def self.toggle
level_before = Rails.logger.level == Logger::DEBUG
Rails.logger.level = debug_before ? Logger::INFO : Logger::DEBUG
@bjensen
bjensen / vol
Created November 12, 2012 10:40
open the newest file of a directory in vim
# --------------------------------------------------------
# vol as a shell script
# --------------------------------------------------------
# You would put this code in a directory that's in your
# path, like ~/bin (PATH=~/bin:$PATH in your .bashrc to
# add a directory like that to your path.)
# The invokation syntax is the same as that of the
# function.
# --------------------------------------------------------
# Example usage:
@bjensen
bjensen / response
Created July 30, 2012 11:54
Test case for debugging datepicker bootstrap
<input type='text' class='datepicker'/>"
@bjensen
bjensen / gist:3067926
Created July 7, 2012 20:01
Used to replicate bootstrap-datepicker error
<div class="modal hide" id="myModal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<input type="text" class="datepicker"></input>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">Close</a>