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
| # foreverb master | |
| # written in pseudo-code | |
| Foreverb.run :queue => current_queue do | |
| check_for_new_command_in_queue (start/stop workers) | |
| start/stop worksers (as foreverb "sub"-workers) | |
| before :each do | |
| check_amqp_for_new_messages (using carrot or official client) | |
| process_message |
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
| require 'rubygems' | |
| require 'mysql2' | |
| client = Mysql2::Client.new(:host => '127.0.0.1',:username => 'checker',:password => 'checker') | |
| client.query("show slave status").each do |r| | |
| lag = r['Seconds_Behind_Master'] | |
| io = r['Slave_IO_Running'] | |
| puts "row = #{r}" | |
| puts "lag = #{lag}" | |
| puts "io = #{io}" |
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
| # I had to do this once because a ruby gem's newer version wasn't officially released yet | |
| # Thought it might come in handy once again | |
| # Note: You will need to install all the required dependencies to compile/package your gem beforehand, i.e. build-essential/make and friends | |
| include_recipe 'git' | |
| git_repo_url = 'https://some.github.com/repository' | |
| gem_name = 'name_of_my_gem' | |
| tmp_gem_dir = "/tmp/#{gem_name}" | |
| options = '--no-rdoc --no-ri' # usually you don't need those on a chef enabled machine |
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 | |
| # | |
| # This script is intended for syncing very large S3 buckets (+1000000 objects) | |
| # to a local storage. I couldn't find any other tools which wouldn't crap out | |
| # because of the rather high number of objects to take care of (I'm looking at you, | |
| # s3cmd!). | |
| # | |
| # What it does: | |
| # - Takes a batch of #batch_size (it's 500 right now) of objects | |
| # - Spawns 500 threads and downloads each one individually |
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
| require 'csv' | |
| require 'securerandom' | |
| PASS_LENGTH = 16 | |
| raise "You need to specify a csv file" if ARGV[0].nil? || !File.exists?(ARGV[0]) | |
| csv_file = ARGV[0] | |
| def password |
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
| require 'csv' | |
| SAMBA_TOOL='/usr/bin/samba-tool' | |
| raise "You need to specify a csv file" if ARGV[0].nil? || !File.exists?(ARGV[0]) | |
| CSV::Converters[:blank_to_nil] = lambda do |field| | |
| field && field.empty? ? nil : field | |
| end |
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
| #!/bin/bash | |
| #The MIT License (MIT) | |
| # | |
| #Copyright (c) 2014 Moritz Heiber <hello@heiber.im> | |
| # | |
| #Permission is hereby granted, free of charge, to any person obtaining a copy | |
| #of this software and associated documentation files (the "Software"), to deal | |
| #in the Software without restriction, including without limitation the rights | |
| #to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| #copies of the Software, and to permit persons to whom the Software is |
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
| #!/bin/bash | |
| set -xeu | |
| declare -a DOMAINS | |
| DOMAINS=(enter your domains here) # separated by spaces | |
| DIR="/tmp/letsencrypt-auto" | |
| LETSENCRYPT="/home/moe/letsencrypt" | |
| URL="https://acme-v01.api.letsencrypt.org/directory" |
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
| #!/bin/bash | |
| set -ex | |
| # Remove containers | |
| docker ps -q -f status=exited | xargs --no-run-if-empty docker rm | |
| # Remove volumes | |
| docker volume ls -qf dangling=true | xargs --no-run-if-empty docker volume rm |
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
| -----BEGIN PGP MESSAGE----- | |
| hQEMA9X0O2Qy6nfzAQf/RTwCGoVX6uX+Hd6aRE4mjxR3cUIMuWhvEbNUHfNIZlF7 | |
| XD5CGx/3dC/bGVatS4g5MeWOz43Sb9jAuvrTYgsSuWRwIocZNRIhpQndBOORCTdb | |
| IO4mp05KjpaXueg8YN/T7W8cCNnMfaexIlmh1ellcm8bHQglf1gQVyyfgJ7+Xv2m | |
| v16B3a3sRvGACLyulXKwHf9xoEfE0OjEisxuU0NbiA/MQVo95hFhot+B9ArRhvhb | |
| 6+Iox6yF94wW9HbRESoxDS3Q+CajEfpGlFXmt+eSHUpqRpozauwECbLyXn+dTPW8 | |
| DYbQxUbFg9FWXMsX0NfdO4Y1cpP76L2cAPWMUBROMtLtAd7d9csinNDF+ZmFNi5V | |
| xXLrc4ztgxHCedaZRkdbtdWj8dZGdznMLlnIufuN2u7LH3SaVd4NQoIvMMozuD2Z | |
| yM5w1zNoxyP/TUJMvKnMdu5UahgZK7vYMEIRZb95VNzruayx0veFp4s+IuK3aRfH |
OlderNewer