duplicates = multiple editions
A Classical Introduction to Modern Number Theory, Kenneth Ireland Michael Rosen
A Classical Introduction to Modern Number Theory, Kenneth Ireland Michael Rosen
| require 'webrick' | |
| require 'webrick/https' | |
| require 'ds9' | |
| class HTTP2Server < WEBrick::HTTPServer | |
| SETTINGS = [ [DS9::Settings::MAX_CONCURRENT_STREAMS, 100] ] | |
| class HTTP2Response < WEBrick::HTTPResponse | |
| def initialize config, ctx, stream_id | |
| @ctx = ctx |
| require 'socket' | |
| require 'openssl' | |
| require 'puma/server' | |
| require 'ds9' | |
| class Server < DS9::Server | |
| def initialize socket, app | |
| @app = app | |
| @read_streams = {} | |
| @write_streams = {} |
| /* | |
| The original script: https://github.com/dherbst/slack-invite-script/blob/master/code.js | |
| */ | |
| /* | |
| Get channels from: curl 'https://golang.slack.com/api/channels.list?token={token}' | json_pp | |
| */ | |
| function getInviteChannels() { | |
| return ['C123123123']; |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <link href='http://fonts.googleapis.com/css?family=Indie+Flower' rel='stylesheet' type='text/css'> | |
| <style> | |
| html { | |
| padding: 5mm; | |
| background-color: #e9e9e9; |
Your challenge, should you accept it, is to write a Ruby library that will modify an existing program to output the number of times a specific method is called.
You solution library should be required at the top of the host program, or via ruby's -r flag (i.e. ruby -r ./solution.rb host_program.rb).
Your solution library should read the environment variable COUNT_CALLS_TO to determine the method it should count. Valid method signatures are Array#map!, ActiveRecord::Base#find, Base64.encode64, etc.
Your solution library should count calls to that method, and print the method signature and the number of times it was called when the program exits.
Also, your solution should have a minimal impact on the program's running time. set_trace_func is a no-go...
| #!/usr/bin/env ruby | |
| # | |
| # Mac fix 1 - Install the Nokogiri gem on Mac OS 10.9 Mavericks | |
| # | |
| # Usage: to configure and install using Bundler, pass in 'bundle' as an argument to the script. | |
| # | |
| # Nokogiri works at a very low level, so it has many issues on various platforms. | |
| # As a result, the command `install gem nokogiri` often will fail. This fix is for | |
| # errors involving 'libiconv', such as the following one I encountered: | |
| # |
| # CONFIG | |
| SNMP_COMMUNITY=public | |
| SYSCONTACT=dan | |
| SYSLOCATION=Berlin | |
| # get packages | |
| apt-get install snmpd xinetd vim | |
| mkdir -p /opt/observium && cd /opt |
| ssl on; | |
| ssl_certificate /path/to/certs/thedotproduct.org.pem; | |
| ssl_certificate_key /path/to/certs/thedotproduct.org.key.unsigned; | |
| # References used along with my own work: | |
| # https://raymii.org/s/tutorials/Pass_the_SSL_Labs_Test_on_NGINX_(Mitigate_the_CRIME_and_BEAST_attack_-_Disable_SSLv2_-_Enable_PFS).html | |
| # https://coderwall.com/p/ebl2qa | |
| # http://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/ | |
| # http://code-bear.com/bearlog/2013/06/26/nginx-ssl-config-for-forward-secrecy/ | |
| # https://www.owasp.org/index.php/Transport_Layer_Protection_Cheat_Sheet#Rule_-_Only_Support_Strong_Cryptographic_Ciphers |
Locate the section for your stash remote in the .git/config file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@stash.internal:private/repository.git
Now add the line fetch = +refs/pull-requests/*:refs/remotes/origin/pull-requests/* to this section. Obviously, change the stash url to match your project's URL. It ends up looking like this: