This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def weighted | |
a = [] | |
(1..60).each do |i| | |
a << { value: "HIGH_#{i}", weight: 5 } | |
end | |
(1..30).each do |i| | |
a << { value: "MID_#{i}", weight: 3 } | |
end | |
(1..15).each do |i| | |
a << { value: "LOW_#{i}", weight: 2 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
production: | |
adapter: postgresql | |
encoding: unicode | |
sslmode: require | |
url: postgres://user:password@host:port/db |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Handling Application rights thanks to roles | |
# | |
# A direct adaptation of http://through-voidness.blogspot.fr/2013/10/advanced-rails-4-authorization-with.html | |
# but much more performance-wise | |
class ApplicationPolicy | |
attr_reader :user, :record | |
def initialize(user, record) | |
raise Pundit::NotAuthorizedError, 'Must be signed in.' unless user | |
@user = user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/fail2ban/filter.d/traefik-auth.conf | |
[Definition] | |
failregex = ^<HOST> \- \S+ \[\] \"(GET|POST|HEAD) .+\" 401 .+$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Applescript to highlight ruby code in Pages | |
# Requirements : Pygments (http://pygments.org/languages/) : pip install Pygments | |
# Tutorial: https://shomeya.com/articles/screencast-how-to-add-syntax-highlighting-to-pages-and-keynote | |
try | |
set old to the clipboard as record | |
end try | |
tell application "System Events" to keystroke "c" using command down | |
do shell script "export LC_CTYPE=UTF-8; pbpaste | /usr/local/bin/pygmentize -l ruby -f rtf -O style=default | pbcopy -Prefer rtf" | |
tell application "System Events" to keystroke "v" using command down | |
delay 0.05 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
# Display branch statuses | |
# | |
# @author Manuel Tancoigne <[email protected]> | |
# @license MIT | |
# @version 0.2.3 | |
# | |
# Requirements |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
# Find projects with outdated dependencies | |
# | |
# Usage: | |
# airsec <gem> | |
# airsec <gem> [[min version] max version] | |
# |
OlderNewer