Skip to content

Instantly share code, notes, and snippets.

@vasanthk
vasanthk / System Design.md
Last active July 8, 2024 14:43
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@philipz
philipz / readme.md
Created December 1, 2015 09:23
Docker Swarm & Network on VMware ESXi

Reference

  1. Get started with multi-host networking
  2. Docker Machine and VMware vSphere

#Set up a key-value store

Docker-Consul

docker-machine create docker-consul --driver vmwarevsphere --vmwarevsphere-datacenter ha-datacenter --vmwarevsphere-vcenter 192.168.2.12 --vmwarevsphere-username root --vmwarevsphere-password PASSWORD --vmwarevsphere-datastore 500G --vmwarevsphere-network "VM Network"

Run progrium/consul

docker $(docker-machine config docker-consul) run -d --restart=always -p 8500:8500 -h consul progrium/consul -server -bootstrap #Create a Swarm cluster

@ikatson
ikatson / fswatch_propagate_pwd_changes_to_docker.sh
Created October 16, 2014 06:24
fswatch_propagate_pwd_changes_to_docker
function fswatch_propagate_pwd_changes_to_docker () {
echo "Starting fswatch on $PWD"
# tracking previous not to get into endless loop of changing the same file
local previous=''
fswatch -r "$PWD" | while read file; do
if [[ previous != "$file" ]]; then
docker run --rm -v "$PWD":"$PWD" busybox touch -c "$file"
fi
previous="$file"
done
@sigmaris
sigmaris / file deleted
Last active July 12, 2019 12:56
Deleted Gist
We couldn’t find that file to show.
@thoop
thoop / nginx.conf
Last active December 8, 2023 21:55
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
@plentz
plentz / nginx.conf
Last active July 2, 2024 13:20
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
class TeamCity
def self.running?
ENV.include? 'TEAMCITY_PROJECT_NAME'
end
def self.method_missing(method, *args, &block)
return unless running?
message_name = camel_case method.to_s
publish message_name, args[0]
@rafaelfelix
rafaelfelix / ec2tags.rb
Last active January 17, 2020 08:55 — forked from drohr/ec2tags.rb
Hack to get ec2 tags to facter. Depends on aws-cli (https://github.com/aws/aws-cli), jq (http://stedolan.github.io/jq/) and the JSON RubyGem (http://rubygems.org/gems/json)
require 'facter'
require 'json'
if Facter.value("ec2_instance_id") != nil
instance_id = Facter.value("ec2_instance_id")
region = Facter.value("ec2_placement_availability_zone")[0..-2]
tags = Facter::Util::Resolution.exec("aws ec2 describe-tags --filters \"name=resource-id,values=#{instance_id}\" --region #{region} | jq '[.Tags[] | {key: .Key, value: .Value}]'")
parsed_tags = JSON.parse(tags)
parsed_tags.each do |tag|
@justlaputa
justlaputa / jenkins-api.md
Last active May 17, 2024 14:53
Jenkins Json API

jobs

jenkins_url + /api/json?tree=jobs[name,color]

builds

jenkins_url + /job/${job_name}/api/json?tree=builds[number,status,timestamp,id,result]

last build

@wigsy
wigsy / test_patterns.rb
Created September 12, 2012 04:29
Test Logstash GROK Filters
require 'rubygems'
require 'grok-pure'
# Set a new matcher
grok = Grok.new
# Load default and custom patterns
grok.add_patterns_from_file("/etc/logstash/patterns/default")
grok.add_patterns_from_file("/etc/logstash/patterns/mycustoms")