Skip to content

Instantly share code, notes, and snippets.

👾
Work from Spaces

Braden Schaeffer bschaeffer

👾
Work from Spaces
Block or report user

Report or block bschaeffer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View filebeat.log
INFO instance/beat.go:571 Home path: [/usr/share/filebeat] Config path: [/config] Data path: [/usr/share/filebeat/data] Logs path: [/usr/share/filebeat/logs]
INFO instance/beat.go:579 Beat ID: ef51dbfd-90fb-4517-bcac-8a4ed45df79c
INFO [index-management.ilm] ilm/ilm.go:129 Policy name: filebeat-7.1.1
INFO add_cloud_metadata/add_cloud_metadata.go:350 add_cloud_metadata: hosting provider type detected as gcp, metadata={"availability_zone":"us-central1-b","instance":{"id":"4300596892232664528","name":"gke-logload-test-custom-bd5d436a-0l3s"},"machine":{"type":"custom-6-15360"},"project":{"id":"fs-ops"},"provider":"gcp"}
INFO [seccomp] seccomp/seccomp.go:116 Syscall filter successfully installed
INFO [beat] instance/beat.go:827 Beat info {"system_info": {"beat": {"path": {"config": "/config", "data": "/usr/share/filebeat/data", "home": "/usr/share/filebeat", "logs": "/usr/share/filebeat/logs"}, "type": "filebeat", "uuid": "ef51dbfd-90fb-4517-bcac-8a4ed45df79c"}}}
INFO [beat] instance/beat.go:836 Build info {"system
@bschaeffer
bschaeffer / wait.go
Last active May 9, 2019
Shared Request - Shares a single request across multiple go routines
View wait.go
package main
import (
"fmt"
"sync"
"time"
)
type SharedRequest struct {
data string
@bschaeffer
bschaeffer / main.go
Created Jan 18, 2019
WaitGroup example
View main.go
package main
import (
"fmt"
"runtime"
"sync"
)
var wg sync.WaitGroup
@bschaeffer
bschaeffer / load_test.rb
Last active Sep 26, 2018
Load testing example (producer->consumer pattern)
View load_test.rb
class LoadTest
def initialize(time:, rate:, pool:)
@time = time
@rate = rate
@pool = pool
@requests = []
@started = false
@shutdown = false
@lock = Mutex.new
@cond = ConditionVariable.new
View config.yml
version: 2.0
jobs:
build:
working_directory: ~/prism
docker:
- image: ruby:2.2.4-alpine
- image: percona:5.6.35
environment:
- MYSQL_ROOT_PASSWORD=
@bschaeffer
bschaeffer / nginx_rails_asset_headers.conf
Created May 12, 2015
nginx_rails_asset_headers.conf
View nginx_rails_asset_headers.conf
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
}
@bschaeffer
bschaeffer / migration.rb
Last active Dec 15, 2015
Mass update counter cache columns (with Rails references)
View migration.rb
class UpdateCounters < ActiveRecord::Migration
def up
say_with_time 'Updating counter_cache_column for ModelWithColumn' do
ActiveRecord::Base.connection.execute <<-SQL
UPDATE model_with_column
SET counter_cache_column = (
SELECT COUNT(*)
FROM model_with_counter_cache
WHERE model_with_counter_cache.reference = model_with_column.id
)
@bschaeffer
bschaeffer / just_created.rb
Last active Sep 12, 2015
Rails 4 compatible #just_created?
View just_created.rb
class User < ActiveRecord::Base
attr_accessor :just_created
after_create :set_just_created
def just_created?
!!just_created
end
private
@bschaeffer
bschaeffer / untitled
Created Dec 10, 2014
Apache Bench: Rackspace (Blog+Rails+nginx)
View untitled
This is ApacheBench, Version 2.3 <$Revision: 1554214 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking biginterview.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
View atom-crash.txt
Process: Atom Helper [76665]
Path: /Applications/Atom.app/Contents/Frameworks/Atom Helper.app/Contents/MacOS/Atom Helper
Identifier: com.github.atom.helper
Version: 0.146.0 (0.146.0)
Code Type: X86-64 (Native)
Parent Process: Atom [73996]
Responsible: Atom [73996]
User ID: 501
Date/Time: 2014-11-13 17:06:29.571 -0500
You can’t perform that action at this time.