Skip to content

Instantly share code, notes, and snippets.

View thijsc's full-sized avatar

Thijs Cadier thijsc

View GitHub Profile
@thijsc
thijsc / config.json
Created July 6, 2023 10:17
Custom dashboard for reporting hosts
{
"title": "Reporting hosts",
"description": "",
"visuals": [
{
"title": "All",
"line_label": "%name%",
"display": "LINE",
"format": "number",
"draw_null_as_zero": true,
@thijsc
thijsc / Apdex.json
Last active June 28, 2023 09:29
Custom dashboard config for apdex score and counts
{
"title": "Apdex",
"description": "",
"visuals": [
{
"title": "Apdex",
"line_label": "%namespace%",
"display": "LINE",
"format": "number",
"draw_null_as_zero": false,
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
ethernets:
ens1f0:
match:
macaddress: {{ hostvars[inventory_hostname]['interfaces']['ens1f0'] }}
ens1f1:
match:
@thijsc
thijsc / assignment.rb
Last active August 8, 2020 09:07
Little wrapper script around Kafka command line tools to assign topics.
#!/usr/bin/env ruby
require "fileutils"
require "json"
ZOOKEEPER = raise "Put your zookeeper list here"
DEFAULT_BROKER_LIST = raise "put your broker list here (1,2,3)
FileUtils.rm_f "/tmp/topics.json"
FileUtils.rm_f "/tmp/assignment.json"
@thijsc
thijsc / lifetime_value.rb
Created April 17, 2018 18:39
Calculating lifetime value example
# Customer Acquisition Cost
@total_cac = 5_000.0
@discounts = 1_000.0
@new_customers = 30
@cac =
(@total_cac + @discounts) / @new_customers
puts "Customer Acquisition Cost: #{@cac}"
@thijsc
thijsc / benchmark.rb
Created December 6, 2017 12:12
Naive Ruby backtrace benchmark
require "benchmark"
puts(Benchmark.measure {
1_000_000.times do
1 + 1
end
})
puts(Benchmark.measure {
1_000_000.times do
@thijsc
thijsc / Gemfile
Created July 10, 2017 19:16
Barebones standalone Ruby app with AppSignal
source 'https://rubygems.org'
gem "appsignal"
@thijsc
thijsc / Gemfile
Created July 6, 2017 14:58
Sequel standalone example
source 'https://rubygems.org'
gem 'sequel'
gem 'sqlite3'
gem 'appsignal'
@thijsc
thijsc / example.rs
Last active January 29, 2016 13:08
For Harm
use std::env;
fn main() {
let first = env::args().nth(1);
match first {
Some(ref value) if value == "create" => println!("in create"),
Some(_) => println!("smt else"),
None => println!("No arg given")
}
}
@thijsc
thijsc / screenshots.rake
Last active February 3, 2021 22:38
Example of creating screenshots of your site using Capybara and Selenium, for details: http://blog.appsignal.com/blog/2015/07/21/automated-screenshots-using-capybara.html
BROWSER_WIDTH = 1600
BROWSER_HEIGHT = 1200
Capybara.default_driver = :selenium
include Capybara::DSL
def take_screenshot(path, name, convert_options={})
# Wait for JS to load data and so on
sleep 2
retinafy_screen