Skip to content

Instantly share code, notes, and snippets.

View kaspergrubbe's full-sized avatar

Kasper Grubbe kaspergrubbe

View GitHub Profile
kaspergrubbe / jemalloc5.rb
Created July 26, 2022 18:47
Tuning Jemalloc 5
# Inspiration:
jemalloc_conf = {
# Maximum number of arenas to use for automatic multiplexing of threads and arenas.
# The default is four times the number of CPUs, or one if there is a single CPU.
narenas: 2,
# Enabling jemalloc background threads generally improves the tail latency for application threads,
# since unused memory purging is shifted to the dedicated background threads.
# In addition, unintended purging delay caused by application inactivity is avoided with background threads.
require "socket"
require "openssl"
class TlsCheckJob
include Sidekiq::Worker
def perform
domains =
(domains).each do |org_domain|
+ ./configure --build=x86_64-linux-gnu --disable-install-doc --enable-shared --with-jemalloc
checking for ruby... /usr/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
kaspergrubbe / calculate_backoff.rb
Last active October 31, 2018 14:55
Calculate Redis-rb backoff and print a nice table
require 'bundler/inline'
gemfile do
source ''
gem 'markdown-tables', '1.0.2'
attempts = ARGV[0].to_i
reconnect_delay = ARGV[1].to_f
reconnect_delay_max = ARGV[2].to_f
"red": {
"50": "#ffebee",
"100": "#ffcdd2",
"300": "#e57373",
"500": "#f44336",
"700": "#d32f2f",
"800": "#c62828",
"900": "#b71c1c"
set -euxo pipefail
LABEL maintainer=""
echo "Building and pushing ${REPOOWNER}/${REPONAME} version ${VERSION}" \
while true; do
FILENAME=$(date +%s)
openssl rand -out $(echo $FILENAME).bin -base64 $(( 2**30 * 3/4 ))
curl -T $(echo $FILENAME).bin --user user:password
rm $(echo $FILENAME).bin
<iframe allowtransparency="true" data-event-id="192964" frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="true" src="javascript:void(0)" vspace="0" width="100%" height="189" id="billetto_tickets_widget_embed_192964"></iframe><div class="js-event-widget-powered-by" style="overflow: hidden!important;margin-top: 5px!important;margin-bottom: 5px!important">
<a href="" style="line-height: 18px!important;font-size: 10px!important;important;color: #666!important;" target="_blank">
<img alt="Billetto" height="18" src="" style="float: right!important;line-height: 18px!important;height: 18px!important;width: 60px!important;margin-left: 5px!important;display: block!important;outline: none!important;border : 0!important;" width="60">
<span style="float: right!important;font-family: sans-serif!important;">Powered by</span>
kaspergrubbe / geonames_postgres.rb
Last active April 4, 2024 08:12
Import files from into a PostgreSQL database that runs Postgis
#!/usr/bin/env ruby
require 'open3'
require 'fileutils'
def run_command(command)
puts("+: " + command)
Open3.popen2e(command) do |stdin, stdout_stderr, wait_thread| do
stdout_stderr.each {|l| puts l }
kaspergrubbe /
Created February 3, 2017 03:08
Build termite terminal and vte/vte-ng on Ubuntu
apt-get install autoconf libglib2.0-dev gtk-doc-tools libpcre2-dev libgirepository1.0-dev gperf libvte-2.91-dev libvte-dev valac unzip
cd vte-ng-0.46.0.a
make && make install
cd ~
rm -rf vte-ng-0.46.0.a/