# frozen_string_literal: true
class Doc
include Mongoid::Document
include Mongoid::Timestamps
This file contains 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
# frozen_string_literal: true | |
require 'boo/validation' | |
module API | |
module Validations | |
module Params | |
Search = Boo::Validation.Params do | |
configure do | |
config.type_specs = true |
This file contains 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
install() { | |
if which tput >/dev/null 2>&1; then | |
ncolors=$(tput colors) | |
fi | |
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then | |
RED="$(tput setaf 1)" | |
GREEN="$(tput setaf 2)" | |
YELLOW="$(tput setaf 3)" | |
BLUE="$(tput setaf 4)" | |
BOLD="$(tput bold)" |
This file contains 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
module Mongoid | |
module Taggable | |
extend ActiveSupport::Concern | |
included do | |
field :tags, type: Array, default: [] | |
index tags: 1 | |
def tag_list=(tags) | |
self.tags = tags.to_s.split(",").collect{ |t| t.strip }.delete_if{ |t| t.blank? } |
This file contains 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 | |
require 'net/ssh' | |
require 'timeout' | |
require 'unicode' | |
require 'colorize' | |
hosts = ['127.0.0.1'] | |
ports = ['22'] | |
users = ['root', 'admin', 'ec2-user'] |
This file contains 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
Firewall { | |
require => undef, | |
} | |
firewall { '000 INPUT allow related and established': | |
proto => 'all', | |
action => 'accept', | |
state => ['RELATED', 'ESTABLISHED'] | |
} | |
firewall { '001 accept all icmp': | |
proto => 'icmp', |
This file contains 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
# = Class: profiles::dns::server | |
# | |
# Author: Coto Cisternas <cotocisternas@gmail.com> | |
class profiles::dns::server ( | |
$reverse = $profiles::params::primary_reverse, | |
$primary_domain = $profiles::params::domain, | |
$ns = $profiles::params::bind_nameservers, | |
$admin_email = $profiles::params::bind_admin_email, | |
$forwarders = $profiles::params::bind_forwarders, | |
$allow_query = $profiles::params::bind_allow_query, |
This file contains 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
require 'openssl' | |
require 'base64' | |
key = 'hello'.ljust(8, "\x00") | |
txt = 'hello'.ljust(64, "\x00") | |
des = OpenSSL::Cipher.new('DES-ECB') | |
des.encrypt | |
des.key = key | |
plain = des.update(txt) + des.final | |
Base64.encode64(plain) |
This file contains 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
from Crypto.Cipher import DES | |
import base64 | |
key = 'hello'.ljust(8, '\x00') | |
txt = 'hello'.ljust(64, '\x00') | |
des = DES.new(key, DES.MODE_ECB) | |
str = des.encrypt(txt) | |
base64.b64encode(str) |