Skip to content

Instantly share code, notes, and snippets.

@dayreiner
dayreiner / enterprise_token.rb
Created May 26, 2023 17:46 — forked from markasoftware/enterprise_token.rb
OpenProject Enterprise mode for free
############ REPLACE app/models/enterprise_token.rb in the source code with this file! ################
############ also be sure to RESTART OpenProject after replacing the file. ################
############ it doesn't show that enterprise mode is enabled in the settings, but all ################
############ enterprise mode features, such as KanBan boards, are enabled. ################
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
@dayreiner
dayreiner / gtin_generate_check_digit_and_case_code.sql
Created September 28, 2022 01:34
Example MariaDB database for storing product GTINs and automatically generating the GS1 check digit and GTIN Master Case Code
--
-- @dayreiner | https://18pct.com/ | https://sensibrands.ca | https://github.com/dayreiner
--
-- An example database for storing product GTINs and generating the GS1 check digit and GTIN master case code.
-- When an 11-digit GTIN is inserted, a trigger calls the function to generate the GS1 check digit and insert it into the check_digit column.
-- A second trigger generates the master case code GTIN and inserts that value in the master_case_code column.
-- Expanded upon from the function in this article: https://www.anycodings.com/1questions/4958850/check-for-invalid-upc-in-mysql
--
-- After creating the gtin database, you can insert a gtin to test that the check digit and case code are correctly added:
--
@dayreiner
dayreiner / example-compose-mariadb-galera.yml
Last active April 5, 2017 15:50
Example compose file for a test galera cluster on a single host, as part of an answer to this Stack Exchange: http://stackoverflow.com/questions/41573048/how-to-debug-wsrep-sst-failed-1-operation-not-permitted-with-a-mariadb-gal/41622952#41622952
version: '2'
services:
db-bootstrap:
image: dayreiner/centos7-mariadb-10.1-galera:latest
container_name: db1
restart: never
expose:
- "3306"
- "4567"
- "4568"

Keybase proof

I hereby claim:

  • I am dayreiner on github.
  • I am dayreiner (https://keybase.io/dayreiner) on keybase.
  • I have a public key whose fingerprint is C9B8 3E33 457A 7E82 52BA 1D32 8800 AEA0 322E A3E2

To claim this, I am signing this object:

@dayreiner
dayreiner / zero-to-mariadb+swarm-in-15-minutes-softlayer.md
Last active March 31, 2016 01:43
Part one of a two-part series on building a high-availability containerized MariaDB Galera cluster on top of a multi-master docker swarm in the cloud.

Reposted from this blog entry

Multicolored Containers Photo By: Håkan Dahlström

Part one of a two-part series. The second part will be posted in a couple of days...

While I manage environments across multiple cloud platforms (and even the occasional "traditional" colo) at my workplace, our primary application environment is in IBM Softlayer. I enjoy working with Softlayer -- the API is fairly robust, there's a lot of choice (even bare-metal, should that tickle your fancy) and it allows me to deploy instances in both Toronto and Montreal. Canadian data-residency is a "big deal" for many Canadian companies; which the

@dayreiner
dayreiner / sysctl.conf
Last active July 14, 2023 06:25
A decent base to start tuning off of for centos 7 apache and mariadb systems
# MariaDB Tuning
vm.swappiness = 1
fs.file-max = 2097152
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
# Sets the time before the kernel considers migrating a proccess to another core
kernel.sched_migration_cost_ns = 5000000
# Group tasks by TTY
@dayreiner
dayreiner / monitor-galera-status-citrix-netscaler.md
Last active December 10, 2020 18:56
Monitoring MariaDB / MySQL Galera cluster status with Citrix Netscaler

Monitoring MariaDB Galera Cluster Members with Citrix Netscaler

Also posted here: http://18pct.com/monitoring-mariadb-galera-cluster-members-with-citrix-netscaler/

We run several MariaDB Galera clusters for various client sites and use Citrix Netscaler Application Delivery Controllers to load-balance various services (among other features). With near-synchronous multimaster replication, Galera cluster simplifies application stacks as in many cases you can point each web server at its own corresponding database server and just worry about balancing the load between your application servers.

Citrix netscaler also supports load-balancing across MySQL systems, for instances where you want to spread out reads across systems or want to balance reads and send writes to a specific system.

But what happens when

@dayreiner
dayreiner / log-all-zsh-bash-commands-syslog.md
Last active August 1, 2024 04:59
Log all users zsh / bash commands via syslog without 3rd-party tools or auditd

Sending Bash and ZSH Commands to Syslog

Also posted here: http://18pct.com/sending-bash-and-zsh-commands-to-syslog/

Your bash/zsh history is great if its complete, but it doesn't capture commands across all users, sudo's, root commands etc. In particular with test environments, someone may perform a "one-off" procedure and then months later it needs to be repeated. It would be nice to be able to look up what the user did at the time, and searching through multiple, possibly truncated history files is a pain.

Tools like typescript are great if you're actively documenting, but not something you would use all the time in practice and capture more than just a history of your commands. There are third-party tools like rootsh and Snoopy that can accomplish this, but third-party tools can be overkill if all you want is a quick reference in a re

@dayreiner
dayreiner / docker-1.10.0-rc3-xhyve-osx-install.md
Last active May 10, 2022 08:02
HOWTO: Docker 1.10.0-rc3 on OSX El Capitan with docker-compose 1.6.0-rc2 and docker-machine 0.6.0-rc3. Use Xhyve driver instead of virtualbox for performance.
@dayreiner
dayreiner / docker-1.10.0-rc1-xhyve-osx-install.md
Last active November 9, 2020 13:48
HOWTO: Docker 1.10.0-rc1 on OSX El Capitan with docker-compose 1.6.0-rc1 and docker-machine 0.6.0-rc1. Use Xhyve driver instead of virtualbox for performance.

Docker 1.10.0 RC1 with Docker Compose 0.6 and Docker Machine 1.6 and Xhyve on OSX

Updated install instructions for RC2 are available here

docker

The steps below will uninstall docker, docker-machine and docker-compose under OSX using virtualbox (via either brew or toolbox, or both), and replace them with the latest RC versions of docker, compose and machine using the Xhyve driver for better performance under OSX using Hypervisor.framework.