Skip to content

Instantly share code, notes, and snippets.

View adyrcz's full-sized avatar
🙈
Protecting secrets

Andy Dyrcz adyrcz

🙈
Protecting secrets
View GitHub Profile
@adyrcz
adyrcz / rotatelog.sh
Created June 4, 2014 22:23
rotatelog
#!/bin/bash
# rotates webserver log files
# Version 1.0
# Andy Dyrcz
# Get PATHS and SITENAME from control script name
# get absolute path to program folder
ctl=`readlink -f "$0"`
# get ServerRoot folder containing folders: bin/, conf/, log/, www/
@adyrcz
adyrcz / gist:d5db81ade1fefb769189
Last active August 29, 2015 14:03
Auditcontroller.rb
class AuditsController < ApplicationController
before_action :authenticate_user!, except: [:index, :show]
before_action :correct_user, only: [:edit, :update, :destroy]
before_action :set_audit, only: [:show, :edit, :update, :destroy]
.
.
.
.
.
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :audit
end
@adyrcz
adyrcz / nginx.conf
Created March 24, 2015 01:51
Nginx SSL block
# nginx 1.7 | OpenSSL 1.0.1
# fixes for POODLE OpenSSL vulnerabilities
server {
listen 443 ssl;
ssl_certificate /path/to/signed_cert_plus_intermediates;
ssl_certificate_key /path/to/private_key;
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:50m;
@adyrcz
adyrcz / Good Tech Lead, Bad Tech Lead
Created March 24, 2015 02:00
Good Tech Lead, Bad Tech Lead
Teamwork
Good tech leads act as a member of the team, and consider themselves successful when the team is successful. They take the unsexy grungy work and clear roadblocks so their team can operate at 100%. They work to broaden the technical capabilities of their team, making sure knowledge of critical systems is not concentrated in one or two minds.
Bad tech leads take the high-profile tasks for themselves and are motivated by being able to take credit for doing the work. They optimize locally, keeping team members working on projects that benefit the team at the expense of the engineering organization at large.
Technical vision
Good tech leads have an overall vision for the technical direction of the product and make sure the team understands it. They delegate feature areas to other team members and let them own their decisions. They recognize that their team members are smart, trust them, and rely on them to handle significant pieces of the project.
@adyrcz
adyrcz / nginx.conf
Last active August 29, 2015 14:17
Nginx Logs example
http {
log_format compression '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$gzip_ratio"';
server {
gzip on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
...
@adyrcz
adyrcz / nginx_logs
Last active August 29, 2015 14:17
Nginx Log File Size
$ ls -al
-rw-r--r-- 1 nginx nginx 638962527 Mar 20 11:33 access.log
-rw-r--r-- 1 nginx nginx 98372 Mar 20 10:47 error.log
-rw-r--r-- 1 nginx nginx 3 Feb 14 07:16 nginx.pid
@adyrcz
adyrcz / nginx.conf
Created March 24, 2015 03:33
Nginx log rotation based on time
if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})") {
set $year $1;
set $month $2;
set $day $3;
}
access_log /var/log/nginx/access_$year-$month-$day.log;
@adyrcz
adyrcz / The DevOps Dream.md
Last active August 29, 2015 14:24
The DevOps Dream

In a perfect world, where things are done well, not just quickly, I would expect to find the following when joining the company:

Documentation

  • Accurate / up-to-date systems architecture diagram
  • Accurate / up-to-date network diagram
  • Out-of-hours support plan
  • Incident management plan
  • Change management plan
  • Application documentation
@adyrcz
adyrcz / Allcrons4allusers
Created July 3, 2015 17:14
List all cron jobs for all users
sudo for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done