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 | |
require 'digest/md5' | |
## | |
# This little gist calculates the md5sum as the aws/s3 does. | |
# Either use a non-zero chunk size to specify the chunk size used while | |
# uploading the file, or just don't specify it if you didn't do | |
# a multipart upload. | |
# | |
# To have an example of how to get an aws etag, see: | |
# https://gist.github.com/aerostitch/22992e88315215f100b8 |
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 | |
require 'aws/s3' | |
## | |
# This little gist returns the checksum of and aws file. | |
# This can be the checksum of the file or, if the file has been uploaded in a | |
# multipart format, it's the checksum of the binary concatenation of the | |
# checkusms of the chunks of the multiparts followed by the number of chunks of | |
# the multipart object. | |
# | |
# Tested with aws-sdk-v1 gem. |
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 gist tries to guess the chunk size in Megabytes of a multipart upload of | |
# an AWS file using its local copy and the etag of the remote file. | |
# Here we suppose the chunk size chosen for the upload is an integer in Megabytes. | |
# | |
# To run correctly, it requires the `get_etag` function from | |
# https://gist.github.com/aerostitch/538eda0b2d1d8dd914bf | |
# | |
# You can get the etag of the remote file by using the `get_AWS_file_checksum` function |
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 gist checks if an AWS file's etag matches any of the checksum of its local copy, | |
# this is done without knowing if the file has been uploaded using multipart method or not. | |
# | |
# Here we suppose the chunk size chosen for the upload is an integer in Megabytes | |
# when checking for checksum of a multipart upload. | |
# | |
# To run correctly, it requires the `get_etag` function from | |
# https://gist.github.com/aerostitch/538eda0b2d1d8dd914bf |
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
# This gist is a part of a Rakefile I use to test my Puppet's ERB (templates) files. | |
# Add this to the Rakefile at the root of your puppet module. | |
# | |
# == Examples: | |
# rake test:erb | |
# or | |
# rake test | |
# | |
# Author:: Joseph Herlant ([email protected]) | |
# Copyright:: Copyright (c) 2014 Joseph Herlant |
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 | |
# Author: Joseph Herlant | |
# Last updated: 2015-06-23 | |
# Source: https://gist.github.com/aerostitch/5e5027ee1f6e2e828cd7 | |
# Description | |
# This script's purpose is to test the response time on a url | |
# by doing a simple curl loop (no pause, so a bit hammering). | |
# It returns the several curl metrics in a csv file for further analysis. | |
# | |
TO="localhost" |
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 | |
# Author: Joseph Herlant | |
# Last updated: 2015-05-14 | |
# Source: https://gist.github.com/aerostitch/0ddaea68d0034c26986c | |
# Description: | |
# This script is used to defragment an xfs partition file by file | |
# if the given file has more than 1 fragment. | |
# It writes to a log file that is overwritten every time. | |
# | |
ROOT_DIR="/mysql*" |
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
package main | |
import ( | |
"flag" | |
"fmt" | |
"github.com/awslabs/aws-sdk-go/aws" | |
"github.com/awslabs/aws-sdk-go/service/iam" | |
) | |
// Author: Joseph Herlant |
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
# Find all the mysql-bin* files >=2015-06-24 and < 2015-06-25 and sum their size | |
find /mysql/logs -type f -name 'mysql-bin*' -newermt 2015-06-24 ! -newermt 2015-06-25 -exec du -ch {} + | grep total$ |
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 | |
# I know there are a lot cleaner ways to do that, I just had to do that for a 1 time rush on a really bare server | |
# so bash recurse to list all the zk nodes there | |
list_children () | |
{ | |
if [ $# -le 0 ] | |
then | |
return |
OlderNewer