Skip to content

Instantly share code, notes, and snippets.

View deathbob's full-sized avatar

Bob Larrick deathbob

View GitHub Profile
This is a cool way to add a gist!
# Basically the nginx configuration I use at konklone.com.
# I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com
#
# To provide feedback, please tweet at @konklone or email [email protected].
# Comments on gists don't notify the author.
#
# Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites.
# Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration.
server {
@deathbob
deathbob / go.clj
Last active December 19, 2015 12:59
go vs clojure go routines
(defn foo[]
(let [c (chan)
n 100]
(doseq [i (range n)]
(go
(Thread/sleep 1000)
(>! c i)))
(doseq [i (range n)]
(println (<!! c)))))
@deathbob
deathbob / gist:5283198
Created April 1, 2013 04:07
Sketchup hell solved
model = Sketchup.active_model
entities = model.entities
entities.clear!
# Draw a cylinder
basegroup = entities.add_group
basegroupentities = basegroup.entities
center_point = Geom::Point3d.new(0,0,0)
normal_vector = Geom::Vector3d.new(0,0,1)
radius = 10
lovebob@new-host-5:~/src/collective/collectivedb-test(code_review⚡) » ruby ./cdb_test.rb -s qa-cdb2.collective-media.net -f server_13010.log -n 1
D, [2013-02-27T14:11:42.065721 #10329] DEBUG -- : File pattern: server_13010.log
D, [2013-02-27T14:11:42.065848 #10329] DEBUG -- : File name server_13010.log
I, [2013-02-27T14:11:42.076619 #10329] INFO -- : URL 1 : http://qa-cdb2.collective-media.net/delivery/data?sortField=name&filterid=&format=csv&fromdate=2013%2D1%2D17&grp=zone&sortDirection=ascending&calltype=data&listfilter=&detailfilter=&item=date&todate=2013%2D1%2D17&userid=8683&tkn=4af15c386eaa9f5cdb823ee1db301184&queryid=fromdate%3A2013%2D1%2D17%2Ctodate%3A2013%2D1%2D17%2Cgrp%3Azone%2Citem%3Adate%2Cuserid%3A8683&listtype=zone&tm=1358478904049.4&pagestart=0&timestamp=1358478904049.4&filtertype=&filter=&pagesize=400&detailtype=date
D, [2013-02-27T14:11:42.291645 #10329] DEBUG -- : <?xml version="1.0" encoding="iso-8859-1"?>
<results>
<metadata pagestart="0" fullcount="81" query_time="0" />
<sortInfo s
@deathbob
deathbob / gist:3959533
Created October 26, 2012 15:47
short version
irb --noprompt ✹
input_string = %{Your program will be responsible for analyzing a small chunk of text, the text of this entire dailyprogrammer description. Your task is to output the distinct words in this description, from highest to lowest count with the number of occurrences for each. Punctuation will be considered as separate words where they are not a part of the word.
The following will be considered their own words: " . , : ; ! ? ( ) [ ] { }
For anything else, consider it as part of a word.
Extra Credit:
Process the text of the ebook Metamorphosis, by Franz Kafka and determine the top 10 most frequently used words and their counts. (This will help for part 2) }
irb --noprompt
input_string = %{Your program will be responsible for analyzing a small chunk of text, the text of this entire dailyprogrammer description. Your task is to output the distinct words in this description, from highest to lowest count with the number of occurrences for each. Punctuation will be considered as separate words where they are not a part of the word.
The following will be considered their own words: " . , : ; ! ? ( ) [ ] { }
For anything else, consider it as part of a word.
Extra Credit:
Process the text of the ebook Metamorphosis, by Franz Kafka and determine the top 10 most frequently used words and their counts. (This will help for part 2) };nil
@deathbob
deathbob / output
Created October 22, 2012 15:16
testing against hal+json schema
> ruby schema.rb
/Users/lovebob/.rvm/gems/ruby-1.9.3-p194@halidator/gems/jsonschema-2.0.2/lib/jsonschema.rb:255:in `check_type': _links > ht:user > ht:user > ht:user: Array value found, but a [{"id"=>"link", "type"=>"object", "properties"=>{"href"=>{"type"=>"string", "title"=>"URI of the target resource", "description"=>"Either a URI [RFC3986] or URI Template [RFC6570] of the target resource."}, "templated"=>{"type"=>"boolean", "optional"=>true, "default"=>false, "title"=>"URI Template", "description"=>"Is true when the link object's href property is a URI Template. Defaults to false."}, "type"=>{"type"=>"string", "pattern"=>"^(application|audio|example|image|message|model|multipart|text|video)\\/[a-zA-Z0-9!#\\$&\\.\\+-\\^_]{1,127}$", "optional"=>true, "title"=>"Media type indication of the target resource", "description"=>"When present, used as a hint to indicate the media type expected when dereferencing the target resource."}, "name"=>{"type"=>"string", "optional"=>true, "title"=>"Secondary key", "descript
@deathbob
deathbob / output
Created October 22, 2012 15:13
json schema for hal vs. users.json
> ruby schema.rb
/Users/lovebob/.rvm/gems/ruby-1.9.3-p194@halidator/gems/jsonschema-2.0.2/lib/jsonschema.rb:255:in `check_type': _links > ht:user > ht:user > ht:user: Array value found, but a [{"id"=>"link", "type"=>"object", "properties"=>{"href"=>{"type"=>"string", "title"=>"URI of the target resource", "description"=>"Either a URI [RFC3986] or URI Template [RFC6570] of the target resource."}, "templated"=>{"type"=>"boolean", "optional"=>true, "default"=>false, "title"=>"URI Template", "description"=>"Is true when the link object's href property is a URI Template. Defaults to false."}, "type"=>{"type"=>"string", "pattern"=>"^(application|audio|example|image|message|model|multipart|text|video)\\/[a-zA-Z0-9!#\\$&\\.\\+-\\^_]{1,127}$", "optional"=>true, "title"=>"Media type indication of the target resource", "description"=>"When present, used as a hint to indicate the media type expected when dereferencing the target resource."}, "name"=>{"type"=>"string", "optional"=>true, "title"=>"Secondary key", "descrip
➜ models git:(topic/refactor-messages-34146205) ✗ be rspec analytics/group_timeseries_builder_spec.rb group_membership_spec.rb group_search_spec.rb
....................../Users/lovebob/.rvm/gems/ruby-1.9.3-p194@cardagin-web/gems/activerecord-3.2.8/lib/active_record/attribute_methods/read.rb:96: [BUG] Segmentation fault
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.0.0]
-- Control frame information -----------------------------------------------
c:0071 p:0011 s:0275 b:0273 l:000272 d:000272 METHOD /Users/lovebob/.rvm/gems/ruby-1.9.3-p194@cardagin-web/gems/activerecord-3.2.8/lib/active_record/attribute_methods/read.rb:96
c:0070 p:0031 s:0267 b:0265 l:000264 d:000264 METHOD /Users/lovebob/.rvm/gems/ruby-1.9.3-p194@cardagin-web/gems/activerecord-3.2.8/lib/active_record/attribute_methods/read.rb:72
c:0069 p:0012 s:0261 b:0261 l:000260 d:000260 METHOD /Users/lovebob/.rvm/gems/ruby-1.9.3-p194@cardagin-web/gems/activerecord-3.2.8/lib/active_record/attribute_methods/primary_key.r
c:0068 p:0084 s:0257