Regular expressions to check if a given GitHub token could be valid.
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
# Approximates the chance of at least one collision in a random | |
# distribution of k items across n possible IDs. Adapted from | |
# Karsten's approximate calculator at http://tinyurl.com/5zt6ol | |
def collision_probability( k, n ) | |
1 - Math.exp((-k ** 2) / ( 2.0 * n).to_f) | |
end | |
# The odds of two people having the same birthday are slightly | |
# greater than 50% if you have 23 or more people. | |
puts collision_probability( 23, 365 ) # => 0.515509538061517 |
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 | |
# Bundler needs to find the Gemfile in the current directory, so we | |
# need to dereference symlinks, then chdir to where this script lives | |
this_file = __FILE__ | |
while( File.symlink?(this_file) ) | |
this_file = File.readlink(this_file) | |
end | |
Dir.chdir(File.dirname(this_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
ANSI = {} | |
ANSI[:RESET] = "\e[0m" | |
ANSI[:BOLD] = "\e[1m" | |
ANSI[:UNDERLINE] = "\e[4m" | |
ANSI[:LGRAY] = "\e[0;37m" | |
ANSI[:GRAY] = "\e[1;30m" | |
ANSI[:RED] = "\e[31m" | |
ANSI[:GREEN] = "\e[32m" | |
ANSI[:YELLOW] = "\e[33m" | |
ANSI[:BLUE] = "\e[34m" |
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
Host * | |
ForwardAgent yes | |
ProxyCommand ~/bin/ssh-proxy.sh %h %p username@jump-host | |
ServerAliveInterval 10 | |
ServerAliveCountMax 600 |
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 TimeServer | |
def get_current_time | |
Time.now | |
end | |
end | |
################ | |
URI = 'druby://localhost:8787' |
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 'zlib' | |
print Zlib::Inflate.new.inflate($<.read) |
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
! -------------------------------------------------------------------------------- | |
! This example configuration shows what WE did to get Amazon VPC working with our | |
! ASAs. We use version 8.3(1). This config has not been reviewed or otherwise | |
! blessed in any way by anyone at Amazon. YMMV. | |
! | |
! It differs from Amazon's supplied config by using two different sets of | |
! crypto maps and ACLs, so it brings both tunnels up simultaneously. | |
! | |
! For the purposes of the example, the physical datacenter network is 172.16.1.0/24 | |
! and the VPC is 10.0.0.0/16. |
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
SELECT | |
count(*) as count, priority, object, method from ( | |
SELECT | |
@load_start := LOCATE('object: LOAD;', handler), | |
@method_start := LOCATE('method: ', handler) + 9, | |
@method_end := LOCATE('args:', handler) - 1, | |
IF(@load_start, | |
@object_start := @load_start + 13, | |
@object_start := LOCATE('object: !ruby/object:', handler) + 21 | |
), |
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
https://support.apple.com/guide/mac-help/configure-advanced-content-caching-settings-mchl91e7141a/mac | |
# On client, test caching server availability | |
/usr/bin/assetcachelocatorutil | |
# View log | |
log show --predicate 'subsystem == "com.apple.AssetCache"' | |
log stream --predicate 'subsystem == "com.apple.AssetCache"' | |
# Display content cache settings |
OlderNewer