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 | |
require 'json' | |
require 'shellwords' | |
module Mcp | |
Prop = Data.define(:name, :type, :desc, :req) do | |
def to_h = { type: type, description: desc } | |
end | |
class Definition |
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 WelcomePage | |
attr_reader :greeting, :recent_activity, :support_email | |
def self.from_user(user) | |
new \ | |
greeting: "Good #{user.time_of_day}, #{user.name}", | |
recent_activity: ActivityItem.from_user(user), | |
support_email: Rails.configuration.app.support_email | |
end |
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
{ | |
"description": "Rules based on Microsoft Endpoints at https://endpoints.office.com/endpoints/worldwide?clientrequestid=b794baa0-662f-4592-b4f0-46ab3284b612&ServiceAreas=Skype", | |
"name": "Microsoft Teams", | |
"rules": [ | |
{ | |
"action": "allow", | |
"process": "/Applications/Microsoft Teams.app/Contents/MacOS/MSTeams", | |
"remote-addresses": "52.112.0.0-52.115.255.255,52.122.0.0-52.123.255.255,2603:1063::-2603:1063:3ff:ffff:ffff:ffff:ffff:ffff", | |
"ports": "3478-3481", | |
"protocol": "udp" |
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
require 'minitest/mock' | |
module StubStrict | |
module_function | |
def render_parameters(ruby_parameters) | |
ruby_parameters.map { |type, name| | |
case type | |
when :req; name.to_s | |
when :opt; "#{name} = 'value'" |
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 bash | |
set -e | |
# Usage: | |
# ./install-rclone.sh v1.65.0-beta.7390.2a30c417a.fix-b2-upload-url | |
# Check if the argument is supplied | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 <rclone_version>" | |
exit 1 |
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
option :foo_a | |
option :foo_b, value: {type: Integer} | |
option :bar_x, value: {type: String} | |
option :bar_y | |
option :bar_z, value: {type: Integer} | |
attr_reader :kwargs | |
def self.from_options(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
class Severity | |
include Comparable | |
attr_reader :value | |
ORDER = %i[low medium high] | |
def self.[](value) | |
new(value) | |
end | |
def initialize(value) |
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
code1 = -> { catch(:foo) { throw(:foo, 'string') } } | |
code2 = -> { begin; raise RuntimeError; rescue RuntimeError; 'string' end } | |
code3 = -> { 'string' } | |
Benchmark.ips do |x| | |
x.report("catch a throw") { | |
value = code1.call | |
} | |
x.report("rescue and exception") { |
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
{ | |
"description": "Rules based on Skype FAQ at https://support.skype.com/en/faq/FA148/which-ports-need-to-be-open-to-use-skype-on-desktop", | |
"name": "Skype", | |
"rules": [ | |
{ | |
"action": "allow", | |
"process": "/Applications/Skype.app/Contents/MacOS/Skype", | |
"ports": "443,1000-10000,50000-65000,16000-26000", | |
"protocol": "TCP" | |
}, |
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
{ | |
"description": "Rules based on Microsoft Endpoints at https://endpoints.office.com/endpoints/worldwide?clientrequestid=b794baa0-662f-4592-b4f0-46ab3284b612&ServiceAreas=Skype", | |
"name": "Microsoft Teams classic", | |
"rules": [ | |
{ | |
"action": "allow", | |
"process": "/Applications/Microsoft Teams classic.app/Contents/MacOS/Teams", | |
"remote-addresses": "52.112.0.0-52.115.255.255,52.122.0.0-52.123.255.255,2603:1063::-2603:1063:3ff:ffff:ffff:ffff:ffff:ffff", | |
"ports": "3478-3481", | |
"protocol": "udp" |
NewerOlder