Skip to content

Instantly share code, notes, and snippets.

View gschlager's full-sized avatar
🏠
Working from home

Gerhard Schlager gschlager

🏠
Working from home
View GitHub Profile
@gschlager
gschlager / parameter_binding.rb
Created December 29, 2023 11:26
Extralite parameter binding benchmark
#!/usr/bin/env ruby
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "benchmark-ips"
gem "extralite-bundle", github: "digital-fabric/extralite"
gem "sqlite3"
@gschlager
gschlager / migrate_to_local.rb
Created October 5, 2023 14:55
migrate_to_local
def fix_missing_uploads_parallel
Jobs.run_immediately!
current_db = RailsMultisite::ConnectionManagement.current_db
puts "Attempting to download missing uploads and recreate"
queue = Queue.new
threads = []
base_url = Discourse.store.relative_base_url
@gschlager
gschlager / codenames-timer.js
Last active November 28, 2020 00:32 — forked from davidtaylorhq/codenames-timer.js
Timer UI for codenames.game
/*
Add-on timer for https://codenames.game
When run, a popup window will be opened with a countdown timer.
The timer will automatically reset when a team completes its turn.
There is also a manual reset control and duration setting
To run, start a game, then paste this entire gist into your browser developer tools.
Alternatively, add this URL as a bookmarklet:
javascript:fetch("https://gist.githubusercontent.com/gschlager/d99b2f3cbc239ee6f07bb8399564fef7/raw/codenames-timer.js").then(response => response.text()).then(eval)

Keybase proof

I hereby claim:

  • I am gschlager on github.
  • I am gschlager (https://keybase.io/gschlager) on keybase.
  • I have a public key ASB9c5p66ZSEyLFqAao6g1F9FLRTeiaCWgqhwt_l432C5wo

To claim this, I am signing this object:

@gschlager
gschlager / convert_latin1_to_utf8.sh
Last active May 19, 2020 10:40
Bash script to convert MySQL database that contains UTF-8 data inside tables with latin1 encoding
#!/bin/bash
# based on http://www.whitesmith.co/blog/latin1-to-utf8/
set -e
if [ "$#" -ne 2 ]
then
echo "Usage: $0 database_name /path/to/database_dump.sql"
exit 1
@gschlager
gschlager / README.md
Last active August 29, 2015 14:24
Repair votes that have been migrated from phpBB2 to phpBB3

This UPDATE statement repairs invalid votes that have been migrated from phpBB2 to phpBB3. The invalid votes usually have a poll_option_id with value 127.

You need a backup of your old phpBB2 database (schema phpbb2) and your current phpBB3 database (schema phpbb3) for this to work.