Skip to content

Instantly share code, notes, and snippets.

View baweaver's full-sized avatar
📝
Documenting things

Brandon Weaver baweaver

📝
Documenting things
View GitHub Profile
@madlep
madlep / applicative.rb
Last active January 11, 2021 01:12
Ruby validation applicative example
class Either
def self.pure(value)
Right.new(value)
end
class Left
def initialize(left)
@left = left
end
@mohanpedala
mohanpedala / nginx_performance_tuning.md
Last active March 25, 2024 06:03
NGINX Performance tuning

NGINX Performance Tuning

Content Compressions and Decompression

  • Documentation
    • NGINX http_gzip module
    • NGINX http_gunzip module
  • Enable gzip. by default, we’re not going to compress the responses that we’re getting from proxied servers or any piece of content that isn’t HTML.
  • But if one of our proxied servers happens to send us a pre-compressed response then we probably want to decompress it for clients that can’t handle gzip. In this situation, we’ll use the gunzip module
    $ vim /etc/nginx/nginx.conf
@velvia
velvia / spark-jobserver-ui-thoughts
Created July 29, 2016 07:45
Thoughts on requirements for SJS UI
* See all current contexts
* For each context see all the jobs that are running
* History of past jobs for a given context. Actually this is not technically available via API; but history of past jobs
* Be able to see configuration for each job present or past (this is available via a tiny "C" link in current UI)
* Job results
* Link to Spark UI for detailed analysis
@DrBoolean
DrBoolean / mcft.js
Created December 30, 2015 04:44
Monoidal Contravariant Functors and Transducers
const daggy = require('daggy');
const {foldMap} = require('pointfree-fantasy')
const {concat, toUpper, prop, identity, range, compose} = require('ramda');
// Contravariant functors usually have this shape F(a -> ConcreteType).
// In other words, some type holding a function which is parametric on its input, but not output.
// They don't always have that shape, but it's a good intuition
// Covariant functors are what we're used to, which are parametric in their output
//================================================================
@gbrayut
gbrayut / Systemd.service
Created December 8, 2015 18:14
Bosun Service files
#Bosun unit file at /etc/systemd/system/bosun.service
[Unit]
Description=Bosun Service
After=network.target
After=docker.service
After=rsyslog.service
[Service]
Type=simple
User=root
@havenwood
havenwood / tco.patch
Created April 27, 2015 15:05
Patch to enable Tail Call Optimization in Ruby
diff --git a/vm_opts.h b/vm_opts.h
index b67e254..3e3935a 100644
--- a/vm_opts.h
+++ b/vm_opts.h
@@ -18,8 +18,8 @@
* Following definitions are default values.
*/
-#define OPT_TRACE_INSTRUCTION 1
-#define OPT_TAILCALL_OPTIMIZATION 0
@obolton
obolton / elb-nodejs-ws.md
Last active November 12, 2023 11:49
Configuring an AWS Elastic Load Balancer for a Node.js application using WebSockets on EC2

AWS ELB with Node.js and WebSockets

This assumes that:

  • You are using Nginx.
  • You want to accept incoming connections on port 80.
  • Your Node.js app is listening on port 3000.
  • You want to be able to connect to your Node.js instance directly as well as via the load balancer.

####1. Create load balancer

var gulp = require( 'gulp' ),
server = require( 'gulp-develop-server' );
// run server
gulp.task( 'server:start', function() {
server.listen( { path: './app.js' } );
});
// restart server if app.js changed
gulp.task( 'server:restart', function() {
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing
@havenwood
havenwood / capture_stdout.rb
Created May 23, 2014 19:14
Capture stdout example.
require 'stringio'
module Capture
def self.stdout &block
$stdout = captured_stdout = StringIO.new
block.call
captured_stdout
ensure
$stdout = STDOUT
block.call