This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "concurrent" | |
module Sidekiq | |
module Throttled | |
class ExpirableSet | |
attr_reader :default_ttl | |
def initialize(default_ttl:) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Twingate Remote Access Client | |
Wants=network-pre.target | |
After=network-pre.target NetworkManager.service systemd-resolved.service | |
[Service] | |
ExecStart=/usr/sbin/twingated /etc/twingate/config.json | |
Restart=on-failure | |
RestartSec=5s | |
RuntimeDirectory=twingate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RedisWorkbench | |
attr_accessor :logger | |
def initialize(redis_pool: ::Sidekiq.redis_pool, count: 1000, logger: Logger.new($stdout)) | |
@redis_pool = redis_pool | |
@count = count.to_i | |
@logger = logger | |
end | |
# @example with block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function aye_or_nay() { | |
local response | |
local result | |
while [[ -z "${result:-}" ]]; do | |
echo -n "$1 (y/n) " | |
read response | |
case "$(echo "${response}" | tr '[:upper:]' '[:lower:]')" in | |
aye | yes | y ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CarExperiment < ApplicationExperiment | |
class CappedRollout < Gitlab::Experiment::Rollout | |
def execute_assignment | |
assignments = Users::ExperimentAssignment.where(experiment_name: @experiment.name).group(:variant_name).count | |
variants = %i[polo golf touran].select { |variant_name| assignments[variant_name.to_s].to_i < 5000 } | |
return if variants.blank? | |
variants[Digest::MD5.hexdigest(id).to_i(16) % variants.size] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "active_support/time" | |
require "timecop" | |
Timecop.safe_mode = true | |
RSpec.configure do |config| | |
config.around(:frozen_time) do |ex| | |
time = | |
case (value = ex.metadata[:frozen_time]) | |
when true then Time.current.floor(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2022 Gentoo Authors | |
# Distributed under the terms of the GNU General Public License v2 | |
EAPI=8 | |
inherit rpm bash-completion-r1 | |
DESCRIPTION="Crap" | |
HOMEPAGE="https://www.twingate.com/" | |
SRC_URI="https://packages.twingate.com/rpm/files/ver_1lMD38/twingate-x86_64.rpm -> ${P}.rpm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SidekiqQueueFilterV3 | |
class Observer | |
def initialize(frequency: 1000) | |
@frequency = frequency.to_i | |
@buffer = 0 | |
@stats = Hash.new(0) | |
end | |
def call(event) | |
@buffer += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ -n "$1" ] && [ -n "$2" ]; then | |
LS_COLORS="$(vivid --database "$1" generate "$2")" | |
elif [ -n "$1" ]; then | |
LS_COLORS="$(vivid generate "$1")" | |
else | |
echo "USAGE: $0 [database] theme" >&2 | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "pathname" | |
require "yaml" | |
filetypes = File.open("config/filetypes.yml", "r") { |io| YAML.safe_load(io) } | |
# core types will be processed manually | |
filetypes.delete("core") |
NewerOlder