Skip to content

Instantly share code, notes, and snippets.

Avatar

Kasper Grubbe kaspergrubbe

View GitHub Profile
View tls_expire.rb
require "socket"
require "openssl"
class TlsCheckJob
include Sidekiq::Worker
def perform
domains = Domain.all.map(&:domain_name)
(domains).each do |org_domain|
View 2-5.log
+ ./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
kaspergrubbe / calculate_backoff.rb
Last active Oct 31, 2018
Calculate Redis-rb backoff and print a nice table
View calculate_backoff.rb
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'markdown-tables', '1.0.2'
end
attempts = ARGV[0].to_i
reconnect_delay = ARGV[1].to_f
reconnect_delay_max = ARGV[2].to_f
View material-colors.json
{
"red": {
"50": "#ffebee",
"100": "#ffcdd2",
"300": "#e57373",
"500": "#f44336",
"700": "#d32f2f",
"800": "#c62828",
"900": "#b71c1c"
},
View build_dockerfile.sh
#!/bin/bash
set -euxo pipefail
LABEL maintainer="docker@kaspergrubbe.com"
REPOOWNER="kaspergrubbe"
REPONAME="grubruby-jemalloc"
VERSION="2.5.1"
echo "Building and pushing ${REPOOWNER}/${REPONAME} version ${VERSION}" \
View ftp_random_file_upload.sh
#!/bin/bash
while true; do
FILENAME=$(date +%s)
openssl rand -out $(echo $FILENAME).bin -base64 $(( 2**30 * 3/4 ))
curl -T $(echo $FILENAME).bin ftp://ftp.example.com --user user:password
rm $(echo $FILENAME).bin
done
View ticket_widget.html
<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="https://billetto.dk/l/saelg-billetter-online" style="line-height: 18px!important;font-size: 10px!important;important;color: #666!important;" target="_blank">
<img alt="Billetto" height="18" src="https://assets.billetto.com/assets/logos/logo_text_dark.fallback-240dc3b964adf73b857a290b10e8070bbf018a4f18747af4ae1d328dd1ffa617.png" 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>
</a>
@kaspergrubbe
kaspergrubbe / geonames_postgres.rb
Last active Nov 14, 2020
Import files from Geonames.com into a PostgreSQL database that runs Postgis
View geonames_postgres.rb
#!/usr/bin/env ruby
require 'open3'
require 'fileutils'
def run_command(command)
puts("+: " + command)
Open3.popen2e(command) do |stdin, stdout_stderr, wait_thread|
Thread.new do
stdout_stderr.each {|l| puts l }
@kaspergrubbe
kaspergrubbe / build_termite_and_vte.sh
Created Feb 3, 2017
Build termite terminal and vte/vte-ng on Ubuntu
View build_termite_and_vte.sh
# VTE
apt-get install autoconf libglib2.0-dev gtk-doc-tools libpcre2-dev libgirepository1.0-dev gperf libvte-2.91-dev libvte-dev valac unzip
wget https://github.com/thestinger/vte-ng/archive/0.46.0.a.zip
unzip 0.46.0.a.zip
rm 0.46.0.a.zip
cd vte-ng-0.46.0.a
bash autogen.sh
make && make install
cd ~
rm -rf vte-ng-0.46.0.a/
View php_var_dump_to_file.php
<?php
ob_start();
var_dump($_POST);
$output = ob_get_clean();
$outputFile = "var_dump_output.txt";
$filehandle = fopen($outputFile, 'a') or die("File creation error."");
fwrite($fileHandle, $output);
fclose($fileHandle);