Skip to content

Instantly share code, notes, and snippets.

View Jared-Prime's full-sized avatar
📚

Jared Davis Jared-Prime

📚
View GitHub Profile
#! /usr/bin/env ruby
# see: https://en.wikipedia.org/wiki/BaileyBorwein-Plouffe_formula
require 'bigdecimal'
NUMERATOR = ->(k) do
BigDecimal.new('120')*(k**2) + BigDecimal.new('151')*k + BigDecimal.new('47')
end
DENOMINATOR_1 = ->(k) do
#!/bin/bash
# Adds a timestamp beside every line of data received on STDIN.
# Turns this -> Into that:
# -> Time Data
# [INFO] event 1 -> 04-03-2014 12:00:01 [INFO] event 1
# [INFO] event 2 -> 04-03-2014 12:00:02 [INFO] event 2
# example usage: tail -f some.log | timestamp_it > some-timed.log
def balanced(chars: List[Char]): Boolean = {
def innerBalance(thisChar: Char, rest: List[Char], center: Int): Int = {
def shift(thisChar: String, center: Int): Int = {
if (thisChar == "(") {
center << 1
} else if (thisChar == ")") {
center >> 1
} else {
center
}
$ bundle exec jruby -Xjit.threshold=0 -S benchmarks/survo/runner.rb
Calculating -------------------------------------
run survo 4 i/100ms
-------------------------------------------------
run survo 115.8 (±14.7%) i/s - 564 in 5.004000s
Calculating -------------------------------------
run survo 11 i/100ms
-------------------------------------------------
run survo 128.8 (±10.9%) i/s - 638 in 5.022000s
Calculating -------------------------------------
#! /bin/ruby
File.open( 'scala/euler/problem_11.txt', 'r' ) do |f|
grid = []
f.each_line do |line|
grid << line.split(' ').map(&:to_i)
end
products = []
for row in (0..16)
#!/usr/bin/ruby
require 'csv'
class Parser
attr_reader :original_file, :run_id, :timestamp, :partition_table, :node_ip_address
attr_reader :peak_concurrency, :average_duration, :average_rate, :target_rate
attr_reader :total_calls, :success_rate, :error_rate
addons/chan_mobile.c:1814:/* XXX this does not work with the do_sco_listen() thread (which also bind()s
addons/chan_mobile.c:3584: /* XXX this channel probably does not need to be associated with this pvt */
addons/chan_mobile.c:3716: /* XXX gnu specific strerror_r is assummed here, this
addons/chan_mobile.c:3912: /* XXX volume change requested, we will just
addons/chan_ooh323.c:114: .bridge = ast_rtp_instance_bridge, /* XXX chan unlocked ? */
addons/chan_ooh323.c:3919: /* XXX Deal with Video */
agi/eagi-test.c:91: /* XXX Process the audio with sphinx here XXX */
apps/app_dahdibarge.c:163: /* XXX Make sure we're not running on a pseudo channel XXX */
apps/app_dahdibarge.c:291: /* XXX Should prompt user for pin if pin is required XXX */
apps/app_dial.c:1370: /* XXX this should be saved like AST_CONTROL_CONNECTED_LINE for !single || caller_entertained */
@Jared-Prime
Jared-Prime / 0_reuse_code.js
Last active August 29, 2015 14:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
module SidekiqThreadSafetyDemo
class Threadsafe
include Sidekiq::Worker
include Sidetiq::Schedulable
sidekiq_options :queue => :default
recurrence{ secondly }
SAFETY = Mutex.new
@@count = 0

We must warn the reader about another semantic confusion which has caused error and controversy in probability theory for many decades. It would be quite wrong and misleading to call g(f) the ‘posterior distribution of f’, because that verbiage would imply to the unwary that f itself is varying and is ‘distributed’ in some way. This would be another form of the mind projection fallacy, confusing reality with a state of knowledge about reality. In the problem we are discussing, f is simply an unknown constant parameter; what is ‘distributed’ is not the parameter, but the probability. Use of the terminology ‘probability distribution for f’ will be followed, in order to emphasize this constantly.

Of course, nothing in probability theory forbids us to consider the possibility that f might vary with time or with circumstance; indeed, probability theory enables us to analyze that case fully, as we shall see later. But then we should recognize that we are considering a different problem than the one