This file contains hidden or 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
| @echo off | |
| pushd "%~dp0" | |
| :: Launches ONE instance, prints the child PID, waits, and forwards the exit/crash code to the parent | |
| powershell -Command "$exe='R5\Binaries\Win64\WindroseServer-Win64-Shipping.exe'; Write-Host '[WRAPPER] Starting Windrose Server...' -Fore Green; $p=Start-Process $exe -ArgumentList '-log' -NoNewWindow -PassThru; Write-Host '[WRAPPER] Server running. Child PID is:' $p.Id -Fore Cyan; try { Wait-Process -Id $p.Id } finally { if (!$p.HasExited) { Write-Host '[WRAPPER] Signal received. Cleaning up child PID:' $p.Id -Fore Red; Stop-Process -Id $p.Id -Force } }; exit $p.ExitCode" | |
| :: Captures the PowerShell exit code and forwards it directly to your process manager | |
| exit /b %errorlevel% |
This file contains hidden or 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
| 0eNrs3e2OHsl1IOhbEfibbWR8xxF2fxgD72KBwRjwenZ+GEKD3V2SCLPJNsmWrTV0AXMfuzc2V7L10d1VlCo648negWRJMCB3kRWH+eaJ/Hgy4z3n31988ebbm2/ev3778cXP//3F6y/fvf3w4uf/9O8vPrz+1dtXb+7+7O2rr29e/PzF22+/fHPz6v1n729effnx3fsXv3v54vXbr27+7cXP0+9+8fLFzduPrz++vnkYfP/Dbz9/++3XX9y8v/2Fl98H+eb1NzeffXz32a/ev/v27VcvXr745t2H22Hv3t79Q7ehco6/aS9f/PbFzz/Ldf5Nu/1Hvnr9/ubLh1+Zv3v5B7HzJ7H/MGKK8Rjx9j9/90yMsr19n0Trz0erEG1+um2ffNqUnwne9nflMX4keH0mdofYvOFjP3iauOETYodueJxMsE+m7GKCpQOOAP30CQ6vcujHT48H2Pt3X7z75t37j8/F7T9EvY35/uZfvr358PHzX75+8/Hm/Ye7X/rw8I88nB6+P2+8fPHDb3zyp9/9e2/e/er1h4+vv/zs7h+++1f/5dtXb2637e5k9O7917dnp5cvvnz39Tev3r+6OyH9/MX/ev8H396dytrxu1/c/t9zH2j/aM818e6qEP3QTMPR35IGh8O/Zd4vcPz3wtHhDNCz7pjYDz4KBs/H2ell1NPTS4YzwNNwiwtYfjzkv7r58vVXN+8/uz3Mvnj99v4we+bgL98HrH+Yrbsj8u3H9+/efP7Fza9f/eb13YH679/H/fz27756/d2J4d9fPP3p9oTwy9fvb08ijzciH3/7zd02/eb1+4/f3h/8323kw2989o93tyR39y8fX92fAdrxe6eH//Hf/58Xdx/39+N+F+bb96/evv72689++e3Nm8++vHnz5iHeH5xf7v7g5vPvNubV7U6+u/159+3Hb779+Pu3Tidb/Kv3NzdvH/6Vb377+f2Z6/Nfvn/39eev394Ge/HzX7568+Hm7iz2XJIeT2Nf33x1t903b273+vv |
This file contains hidden or 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 | |
| MAX_COLUMNS_FOR_TABLE = 15 unless defined?(MAX_COLUMNS_FOR_TABLE) | |
| DEFAULT_EDITOR = 'code' unless defined?(DEFAULT_EDITOR) | |
| class PrettyString < String | |
| # https://no-color.org/ | |
| NO_COLOR = ENV.key?('NO_COLOR') || `tput colors`.chomp.to_i < 8 unless defined?(NO_COLOR) | |
| unless defined?(ANSI_COLORS) | |
| ANSI_COLORS = { | |
| red: 31, |
This file contains hidden or 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 | |
| # A quick and easy way to test scopes sql queries by checking only the sql output | |
| # | |
| # is_expected.to have_scope(:user, 1).include('users.id = 1') | |
| # is_expected.to have_scope(:user, 1).match_array([user]) | |
| # is_expected.to have_scope(:user, 1).eq([user]) | |
| module RSpec | |
| module Matchers | |
| class HaveScope |
This file contains hidden or 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 | |
| # frozen_string_literal: true | |
| require 'uri' | |
| require 'json' | |
| require 'net/http' | |
| require 'optparse' | |
| require 'forwardable' | |
| COMMAND_NAME = File.basename(__FILE__) |
This file contains hidden or 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 SnowflakeId < ApplicationService | |
| MAC_ADDRESS_PATTERN = /(?:(?:(?:[a-f0-9]{2}:){5})|(?:(?:[a-f0-9]{2}-){5}))[a-f0-9]{2}/i | |
| MAC_ADDRESS = lambda { | |
| address = RUBY_PLATFORM =~ /darwin/ ? `ifconfig` : `cat /sys/class/net/*/address` | |
| address.match(MAC_ADDRESS_PATTERN).to_s.delete(':') | |
| }.call | |
| NODE_ID = -> { (MAC_ADDRESS.to_i(16) % 1023).to_s(2).rjust(10, '0') }.call | |
| SEQUENCE_STARTED_AT = 1671750375309 | |
| COUNTER_MAX = 4096 | |
This file contains hidden or 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
| echo "Creating $(git rev-parse --git-dir)/hooks/pre-commit.d" | |
| mkdir $(git rev-parse --git-dir)/hooks/pre-commit.d | |
| echo "Downloading rubocop hook into $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop" | |
| wget -O $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop https://gist.githubusercontent.com/brand-it/93d04c839238283e3e756811b9c9cee0/raw/616bf812b58bcefc52d564ed8abacbf30966193c/pre-commit.d_rubocop | |
| echo "Changing rubocop into a executable $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop" | |
| chmod 755 $(git rev-parse --git-dir)/hooks/pre-commit.d/rubocop | |
| echo "adding hooks_directory variable to $(git rev-parse --git-dir)/hooks/pre-commit if it does not already exist" | |
| grep -qxF 'hooks_directory=$(git rev-parse --git-dir)/hooks/pre-commit.d' $(git rev-parse --git-dir)/hooks/pre-commit || echo 'hooks_directory=$(git rev-parse --git-dir)/hooks/pre-commit.d' >> $(git rev-parse --git-dir)/hooks/pre-commit | |
| echo "adding $hooks_directory/rubocop variable to $(git rev-parse --git-dir)/hooks/pre-commit if it do |
This file contains hidden or 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 | |
| # frozen_string_literal: true | |
| require 'net/http' | |
| require 'open-uri' | |
| require 'tempfile' | |
| require File.expand_path('ruby_bash', __dir__).to_s | |
| options = {} |
This file contains hidden or 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
| def format_as_table(header, data) | |
| total_columns = data.first.size | |
| data.insert(0, header) if header | |
| column_widths = total_columns.times.map { |col| data.map { |row| row[col].size }.max } | |
| if header | |
| data.insert(1, Array.new(total_columns, '-').zip(column_widths).map { |a, b| a * b }) | |
| end | |
| data.map do |row| | |
| row.zip(column_widths).map do |cell, width| | |
| cell.to_s.ljust(width) |
This file contains hidden or 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
| 3.1 |
NewerOlder