Skip to content

Instantly share code, notes, and snippets.

@EricR
EricR / keybase.md
Created November 2, 2018 01:45
keybase proof

Keybase proof

I hereby claim:

  • I am ericr on github.
  • I am ericr (https://keybase.io/ericr) on keybase.
  • I have a public key whose fingerprint is 90C9 B0F8 93A3 B45A FC42 9F8C 9685 66F2 C75E 646A

To claim this, I am signing this object:

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
a
about
above
after
again
against
all
am
an
and
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Printf("%s", strings.ToLower("Mixed Case should be down cased")) // => mixed case should be down cased
}
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/sshd</string>
<string>-i</string>
</array>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/sshd</string>
<string>-f /etc/sshd_config</string>
</array>
@EricR
EricR / ngrams.go
Last active December 31, 2015 12:59
package main
import (
"fmt"
"strings"
)
func nGram(text string, n int) (grams []string) {
words := strings.Split(text, " ")
limit := len(words) - (n - 1)
@EricR
EricR / gist:5505404
Last active December 16, 2015 22:09
psych yaml vs. json
require 'benchmark'
require 'psych'
require 'json'
some_data = {:user => {:name => ["Joe", "Smith"]}, :product => {:id => 2, :name => "Whatever"}, :some_long_string => "s" * 2000, :some_long_number => 1000000000 * 100000000000}
some_yaml = some_data.to_yaml
some_json = some_data.to_json
Benchmark.bm do |b|
b.report("yaml parse") { Psych.load(some_yaml) }
package main
import "fmt"
func main() {
nums := []int{1, 3, 4, 8, 9, 12, 15, 20, 25, 31}
result := filterNumbers(nums, func(x int) bool {
return x%2 == 0
})
~/1.9.3 $ chef-client
[#<Gem::Version "11.4.2">, #<Gem::Version "0">]
[#<Gem::Version "1.1.2">, #<Gem::Version "1.1.2">]
[#<Gem::Version "1.6.0">, #<Gem::Version "1.3.0">]
[#<Gem::Version "1.3.0">, #<Gem::Version "1.3.0">]
[#<Gem::Version "1.6.0">, #<Gem::Version "0">]
[#<Gem::Version "1.1.0">, #<Gem::Version "0">]
[#<Gem::Version "6.16.0">, #<Gem::Version "0.6.0">]
[#<Gem::Version "1.1.2">, #<Gem::Version "0">]
[#<Gem::Version "1.3.0">, #<Gem::Version "0">]