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

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@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 / multitail.sh
Last active October 10, 2016 13:38 — forked from stantonk/multitail.sh
Tail multiple logs on multiple hosts
#!/bin/bash
HOSTS=(PUT, YOUR, HOSTS, HERE)
LOGS=(access.*.log, error.*.log)
CMD="tail -f ${LOGS}"
echo "Hit CTRL-C to stop"
sleep 0.5
PIDS=""
for host in ${HOSTS[*]}
@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;