Skip to content

Instantly share code, notes, and snippets.

View kainam00's full-sized avatar

Dmitriy Martynov kainam00

View GitHub Profile
@kainam00
kainam00 / secure-s3-bucket.rb
Last active August 29, 2015 14:26
Remove Everyone / public permissions from S3 bucket objects
#!/usr/bin/env ruby
require 'aws-sdk'
require 'yaml'
# Check args
if ARGV[0].nil? || ARGV[1].nil?
puts "Usage: securey-s3-bucket.rb bucket_name path-to-config-file.yml dryrun(optional)"
puts " Where the config file is a YAML formatted file with the following data:"
puts " access_key_id: xxx"
puts " secret_access_key: yyy"
@kainam00
kainam00 / truncate-tomcat6-logs.rb
Created July 31, 2015 14:50
Truncate tomcat6 logs
#!/usr/bin/ruby
Dir.entries("/var/log/tomcat6").each do |filename|
if filename != "." && filename != ".."
filename = "/var/log/tomcat6/#{filename}"
File.truncate(filename,0)
end
end
@kainam00
kainam00 / genericinit.bash
Created July 15, 2015 19:10
Simple generic init script
#!/bin/bash
# chkconfig: 2345 90 90
# description: process-sqs
### BEGIN INIT INFO
# Provides: myapplication
# Required-Start: network
# Required-Stop: network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Start the program