Skip to content

Instantly share code, notes, and snippets.

View frimik's full-sized avatar

Mikael Fridh frimik

  • Electronic Arts / DICE
  • Uppsala, Sweden
View GitHub Profile
#!/bin/bash
docker rm -f ecs-agent
docker pull 540111577831.dkr.ecr.eu-west-1.amazonaws.com/amazon-ecs-agent:ecs
docker run --name ecs-agent --detach=false --restart=on-failure:10 --volume=/var/run/docker.sock:/var/run/docker.sock --volume=/var/log/ecs:/log --volume=/var/lib/ecs/data:/data --net=host --env-file=/etc/ecs/ecs.config --env=ECS_LOGFILE=/log/ecs-agent.log --env=ECS_DATADIR=/data/ --env=ECS_ENABLE_TASK_IAM_ROLE=true --env=ECS_ENABLE_TASK_IAM_ROLE_NETWORK_HOST=true 540111577831.dkr.ecr.eu-west-1.amazonaws.com/amazon-ecs-agent:ecs
@frimik
frimik / Puppetfile.rb
Created July 14, 2016 01:48
Puppetfile hack
#!/usr/bin/env ruby
#^syntax detection
# I wanted Puppetfiles from git to be specified just as simple as the Forge sourced modules... but without creating a separate method for it such as 'gitmod'
# (C) 2016 Fulhack Industries
method(:mod).owner.class_eval do
alias_method :upstream_mod, :mod
def mod(name, **args)
if name.include? "/"
import redis
r = redis.Redis()
base = 0 # Smallest allowed key in samples
jump = 50 # Key size bins
top = 1300 # Largest allowed key in sample
samples = 1000 # Numbers of samples
bins = []
for i in xrange(1+(top-base)/jump):
'''
@author Bommarito Consulting, LLC; http://bommaritollc.com/
@date 20131029
This script monitors and logs to CSV the status of all tunnels for all VPNs for a single EC2 region.
'''
# Imports
import boto
import boto.ec2
import boto.vpc
@frimik
frimik / README.md
Created August 12, 2013 15:36
Install memcache top (mctop)
yum install http://static.tmtowtdi.se/pub/rpm/rubygem-ruby-pcap/rubygem-ruby-pcap-0.7.8-1.el6.x86_64.rpm \
http://static.tmtowtdi.se/pub/rpm/rubygem-mctop/rubygem-mctop-0.0.4-2.el6.noarch.rpm
@frimik
frimik / conserver.cf
Last active December 17, 2015 15:40
conserver config examples
default full { rw *; }
# 2 Dell examples:
default ipmi-sol-dell {
type exec;
execsubst h=cs;
exec ipmitool -I lanplus -U root -P calvin -H h.lom.domain.net sol activate;
}
@frimik
frimik / logstash
Created March 13, 2013 13:26 — forked from nikolavp/logstash
#! /bin/sh
### BEGIN INIT INFO
# Provides: logstash
### END INIT INFO
# Author: your name here <change email>
#
# Do NOT "set -e"
@frimik
frimik / git-submodule-sync.rb
Created March 9, 2013 19:32
Make damn sure that git submodule sync is going to work.
#! /usr/bin/env ruby
submods = Hash.new
%x{git config -f .gitmodules --get-regexp '^submodule\..*\.(path|url)$'}.lines.each do |l|
submodule, key, value = l.match(/^submodule\.(.*)\.(path|url)\s+(.*)$/)[1..3]
submods[submodule] = Hash.new unless submods[submodule].is_a?(Hash)
submods[submodule][key] = value
end
@frimik
frimik / root.pp
Created February 27, 2013 15:27
user::root class
class user::root {
# Whitelist means we DON'T manage the passwords.
# For the old fashioned people who don't know what an ENC is.
$whitelist_fqdn_array = ['funkyserver1.domain.int']
# valid password regexes
$valid_password_array = ['^\$1\$.{25,}', '^\$foreman\$.{15,}']
if $::root_pw and !member($whitelist_fqdn_array, $::fqdn) {
#!/usr/bin/env ruby
USAGE=<<EOS
Delete files in specified folders that are older than a given number of days.
Options:
-v - verbose. Will list folders and files.
-d - dry run. Like verbose, but does not delete files.
-h - Show this usage help.
Arguments: