Skip to content

Instantly share code, notes, and snippets.

@jayjanssen
jayjanssen / gist:4039319
Created November 8, 2012 15:02
sysctl tuning for HAproxy
net.core.somaxconn = 32768
net.ipv4.conf.all.send_redirects = 1
net.ipv4.ip_nonlocal_bind = 1
net.ipv4.tcp_abort_on_overflow = 0
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_max_tw_buckets = 262144
net.ipv4.tcp_mem = 200000    280000    300000
@jayjanssen
jayjanssen / gist:5697813
Created June 3, 2013 12:33
Testing multicast with iperf
this is a sample of output:
root@percona-db-2:~# iperf -s -u -B 226.94.1.1 -i 1
------------------------------------------------------------
Server listening on UDP port 5001
Binding to local address 226.94.1.1
Joining multicast group 226.94.1.1
Receiving 1470 byte datagrams
UDP buffer size: 122 KByte (default)
------------------------------------------------------------
@jayjanssen
jayjanssen / gist:8e74bc4c5bdefc880ffd
Last active March 16, 2023 02:21
Golang MySQL connection with multiple IPs and connection timeouts
package main
import (
"database/sql"
"fmt"
"github.com/go-sql-driver/mysql"
"log"
"net/http"
"strings"
"time"
@jayjanssen
jayjanssen / gist:6b83c2c06e89c679367d8224be23cb53
Last active February 13, 2020 13:27
ServiceNow Modify TinyMCE Settings -- Client Script, onLoad, Tested on Madrid
function onLoad() {
tinymce.on('AddEditor', function(e) {
e.editor.settings.block_formats = 'Paragraph=p;Preformatted=pre;Quote=blockquote;Heading 1=h1;Heading 2=h2;Heading 3=h3;None=removeformat';
e.editor.settings.forced_root_block = false;
});
}
@jayjanssen
jayjanssen / convox.yml
Last active November 26, 2019 20:12
Shared local rack resources for Convox gen2
# NOT FOR PRODUCTION, JUST FOR LOCAL RACKS!!!!!
# I use this convox.yml to setup local gen2 rack services.
# NOT for apps that have their own resources defined, these are resources are shared across multiple apps
# In production, these are either non-convox SaaS (e.g., I use Elastic cloud for my prod elasticsearch)
# *or* I set them up with `convox resources create` (e.g., my shared redis)
# This config is just a handy way to have local dev services running that my local convox rack can use.
resources:
# Any resources here exposed locally as <resourcename>.resource.<appname>.convox
redis:
type: redis
@jayjanssen
jayjanssen / gist:3453904
Last active January 30, 2019 03:44
Percona Server live query capture settings
set global slow_query_log = OFF;
set global long_query_time = 0;
set global log_slow_verbosity = full;
set global slow_query_log_timestamp_always = ON;
set global slow_query_log_timestamp_precision=microsecond;
set global slow_query_log_use_global_control="log_slow_filter,log_slow_rate_limit,log_slow_verbosity,long_query_time";
@jayjanssen
jayjanssen / parse_bamboo_contacts.pl
Created September 18, 2013 13:41
Parse CSV download from BambooHR to make it useful to import into OSX Contacts
#!/usr/bin/perl
use Text::CSV;
use Data::Dumper;
my $headers = <STDIN>;
my $csv = new Text::CSV;
print "Last, First, Mobile, \"Phone (work)\", \"Email (work)\", \"Skype (work)\"\n";

Keybase proof

I hereby claim:

  • I am jayjanssen on github.
  • I am perconajayj (https://keybase.io/perconajayj) on keybase.
  • I have a public key ASD73ASV9xg29hDRfIRC_K8LFE6ilm4-ylbyr2C3d3moVAo

To claim this, I am signing this object:

@jayjanssen
jayjanssen / semaphore.js
Created May 27, 2011 18:30
Node.js semaphores
var Semaphore = function(callback, context) {
this.semaphore = 0;
this.callback = callback;
this.context = context || this;
};
Semaphore.prototype.increment = function() {
this.semaphore++;
};