Skip to content

Instantly share code, notes, and snippets.

@weirdbricks
weirdbricks / python_install.txt
Created October 11, 2014 22:21
Install Python on FreeBSD via Ansible
ansible all -m raw -a 'env ASSUME_ALWAYS_YES=YES pkg install python'
freebsd-3 | success | rc=0 >>
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100% 944 B 0.9k/s 00:01
Fetching digests.txz: 100% 2 MB 2.1M/s 00:01
Fetching packagesite.txz: 100% 5 MB 2.7M/s 00:02
Processing new repository entries: 100%
FreeBSD repository update completed. 23551 packages processed:
0 updated, 0 removed and 23551 added.
Updating database digests format: 100%
@weirdbricks
weirdbricks / script.rb
Last active August 29, 2015 14:12
atlantic.net describe instances in Ruby
## Lampros Chaidas
## 01/01/2015
## Sample code to list instances from Atlantic.net using Ruby
# tested with Ruby 1.9.3
require 'rest_client'
require 'digest'
require 'uuidtools'
# replace with your access key
@weirdbricks
weirdbricks / create_files.rb
Last active November 21, 2016 23:27
create millions of files for testing purposes
#!/bin/env ruby
require 'thread/pool'
require 'ruby-progressbar'
require 'securerandom'
require 'etc' # to get the number of cores - http://stackoverflow.com/a/34215193
require 'colorize'
require 'sys/filesystem'
include Sys
@weirdbricks
weirdbricks / check_docker_container.sh
Created January 20, 2017 02:35 — forked from ekristen/check_docker_container.sh
Bash Script for Nagios to Check Status of Docker Container
#!/bin/bash
# Author: Erik Kristensen
# Email: [email protected]
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./check_docker_container.sh _container_id_
#
# The script checks if a container is running.
# OK - running
@weirdbricks
weirdbricks / ruby-yaml-validate.sh
Created January 27, 2017 01:11 — forked from xiii/ruby-yaml-validate.sh
Validate YAML in ruby - useful for hiera
#!/bin/bash
#
# Efstathios Xagoraris <[email protected]>
# Validate YAML files using ruby
#
ruby=/usr/share/logstash/vendor/jruby/bin/jruby
if [ $# -eq 0 ]
@weirdbricks
weirdbricks / check_permissions.sh
Created March 13, 2017 02:33
Nagios script that checks permissions for a file
#!/bin/bash
################################
# Lampros Chaidas #
# 03/12/2017 #
################################
stat=/usr/bin/stat
help="Usage: $0 filename_to_check user group octal_permissions\nExample: $0 /usr/bin/stat root root 755"
@weirdbricks
weirdbricks / ec2_group_set
Created October 14, 2017 00:08 — forked from viesti/ec2_group_set
Alter security groups on EC2 nodes
#!/usr/bin/python
from boto.ec2 import connect_to_region
from boto.ec2.group import Group
from pprint import pprint
def main():
module = AnsibleModule(
argument_spec = dict(
ec2_id = dict(required=True),