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
## | |
# | |
# https://github.com/anolson/git_diff | |
require 'git_diff' | |
patch = `git diff main -U0 --diff-filter=AM` | |
diff = GitDiff.from_string(patch) | |
diff.files.each do |diff_file| |
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 | |
## | |
# Compare location-biased autocomplete search results from Mapbox and Google Places | |
# | |
require 'json' | |
require 'net/http' | |
QUERIES = [ |
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 | |
begin | |
require "git" | |
require "datadog_api_client" | |
rescue LoadError | |
Gem.install "git" | |
Gem.install "datadog_api_client" | |
require "git" |
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 Youtube | |
API_KEY = Rails.application.credentials.youtube_api_key.freeze | |
end | |
module Youtube | |
class SomeClass | |
def call | |
puts API_KEY | |
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
#!/usr/bin/env ruby | |
## | |
# Run one or more specs as many times as you need in a row. | |
# | |
# The files are loaded just once for speed and | |
# failure counts are tracked and reported at the end. | |
# | |
# Provide the number of times and the file(s). | |
# i.e. |
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 'rails' | |
# Return the first value from the block that evalues to present. | |
# | |
# objects = [OpenStruct.new(name: nil), OpenStruct.new(name: ' '), OpenStruct.new(name: 'Matz')] | |
# objects.find_present(&:name) # => "Matz" | |
module Enumerable | |
def find_present(&block) | |
each do |item| | |
result = yield(item) |
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 | |
## | |
# Retrieve MFA credentials using the default profile and saving them to the mfa profile. | |
# Old credentials are removed in this process. | |
# | |
require 'json' | |
AWS_CREDS_FILE_PATH = File.join(ENV['HOME'], '.aws/credentials') |
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
# https://github.com/sorisum/valheim-server-docker | |
version: "3.9" | |
services: | |
valheim: | |
image: lloesche/valheim-server | |
volumes: | |
- /mnt/valheim:/config | |
- valheim_data:/opt/valheim | |
ports: | |
- "2456-2458:2456-2458/udp" |
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
#!/bin/bash | |
# | |
# A set of commands to run as pre-commit hooks for git. | |
# | |
# Save this to .git/hooks/pre-commit and make executable to enable | |
# | |
# This will run whenever we run `git commit`. | |
# To skip this, add `-n` or `--no-verify` flag. | |
# |
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
import com.unboundid.ldap.sdk.LDAPConnection; | |
import com.unboundid.ldap.sdk.LDAPException; | |
import com.unboundid.ldap.sdk.LDAPSearchException; | |
import com.unboundid.ldap.sdk.SearchResult; | |
import com.unboundid.ldap.sdk.SearchResultEntry; | |
import com.unboundid.ldap.sdk.SearchRequest; | |
import com.unboundid.ldap.sdk.SearchScope; | |
import com.unboundid.ldap.sdk.controls.SimplePagedResultsControl; | |
import com.unboundid.util.ssl.SSLUtil; | |
import com.unboundid.util.ssl.TrustAllTrustManager; |