Skip to content

Instantly share code, notes, and snippets.

@panmari
panmari / downloader.patch
Created May 19, 2014 15:46
patch for downloader
diff --git a/lib/tasks/update_wiki/Downloader.rb b/lib/tasks/update_wiki/Downloader.rb
index bb58022..93a8ba5 100644
--- a/lib/tasks/update_wiki/Downloader.rb
+++ b/lib/tasks/update_wiki/Downloader.rb
@@ -32,20 +32,24 @@ class Downloader
#calculate percentage
@pct = (@c.to_f/@length.to_f*100).round(3)
#check if article already exists
- check = @client.query("SELECT * FROM pages WHERE page_id = #{name["page_id"]}").count
- unless check == 1
445,534 2-environment-cd /home/mazzzy/go_workspace/simple
445,534 2^done
445,535 (gdb)
445,536 3-gdb-set breakpoint pending on
445,536 3^done
445,537 (gdb)
445,540 4-gdb-set detach-on-fork on
445,540 4^done
445,540 (gdb)
445,544 5-enable-pretty-printing
@panmari
panmari / gdb
Created September 30, 2014 17:40
Loading Go Runtime support.
No source file named /home/mazzzy/go_workspace/gort/src/main.go.
No source file named /home/mazzzy/go_workspace/gort/src/intersectables/csg/node.go.
func BenchmarkMulVec4(b *testing.B) {
m1 := &T{vec4.T{0.38016528, -0.0661157, -0.008264462, -0}, vec4.T{-0.19834709, 0.33884296, -0.08264463, 0}, vec4.T{0.11570247, -0.28099173, 0.21487603, -0}, vec4.T{18.958677, -33.471073, 8.066115, 0.99999994}}
b.ResetTimer()
for i := 0; i < b.N; i++ {
v := vec4.T{1, 1.5, 2, 2.5}
v_1 := m1.MulVec4(&v)
m1.MulVec4(&v_1)
}
}
func (mat *T) MulVec4(v *vec4.T) vec4.T {
return vec4.T{
mat[0][0]*v[0] + mat[1][0]*v[1] + mat[2][0]*v[2] + mat[3][0]*v[3],
mat[0][1]*v[0] + mat[1][1]*v[1] + mat[2][1]*v[2] + mat[3][1]*v[3],
mat[0][2]*v[0] + mat[1][2]*v[1] + mat[2][2]*v[2] + mat[3][2]*v[3],
mat[0][3]*v[0] + mat[1][3]*v[1] + mat[2][3]*v[2] + mat[3][3]*v[3],
}
}
// Strangely, this is the slowest of the three.
<%= f.fields_for :new_drugs do |cf| %>
<div class="row" style="margin-bottom:5px">
<div class="span1"><%= cf.text_field :atc, class: 'xsmall-input' %></div>
<div class="span3"><%= cf.text_field :description %></div>
<div class="span3"><%= cf.text_field :reason %></div>
<div class="span1"><%= cf.text_field :cases_prior, class: 'xsmall-input' %></div>
<div class="span1"><%= cf.text_field :cases_expected, class: 'xsmall-input' %></div>
<div class="span2"><%= cf.text_field :reason, class: 'small-input' %></div>
</div>
<% end %>
# /etc/init/workers.conf - manage a set of Sidekiqs
# This example config should work with Ubuntu 12.04+. It
# allows you to manage multiple Sidekiq instances with
# Upstart, Ubuntu's native service management tool.
#
# See sidekiq.conf for how to manage a single Sidekiq instance.
#
# Use "stop workers" to stop all Sidekiq instances.
# Use "start workers" to start all instances.
# /etc/init/sidekiq.conf - Sidekiq config
# This example config should work with Ubuntu 12.04+. It
# allows you to manage multiple Sidekiq instances with
# Upstart, Ubuntu's native service management tool.
#
# See workers.conf for how to manage all Sidekiq instances at once.
#
# Save this config as /etc/init/sidekiq.conf then manage sidekiq with:
# sudo start sidekiq index=0
2.2.1 :001 > I18n.locale = :'pt-BR'
=> :"pt-BR"
2.2.1 :002 > I18n.l(Date.new, format: :very_long)
=> "Segunda, 01 de Janeiro de -4712, 00:00 h"
2.2.1 :003 > Date.new.strftime("%A, %d de %B de %Y, %H:%M h")
=> "Monday, 01 de January de -4712, 00:00 h"
0.0015717675, 3.1868962E-4, 1.1206594, 0.5
-3.1435353E-4, 0.0015503819, 0.5213502, 0.5
5.2392254E-5, -2.58397E-4, 0.92690206, 3.0
0.0, 0.0, 0.0, 1.0