Skip to content

Instantly share code, notes, and snippets.

View dominikh's full-sized avatar

Dominik Honnef dominikh

View GitHub Profile
@dominikh
dominikh / analysis.draft.md
Created April 29, 2022 21:10 — forked from MattPD/analysis.draft.md
Program Analysis Resources (WIP draft)

Keybase proof

I hereby claim:

  • I am dominikh on github.
  • I am dominikh (https://keybase.io/dominikh) on keybase.
  • I have a public key whose fingerprint is 038E 28ED 4EDF 6B5A D10D A211 78F6 768C 8D4B 0ED7

To claim this, I am signing this object:

module Cinch
module Plugin
module ClassMethods
def enable_acl
hook(:pre, :for => [:match], :method => lambda {|m| check_acl(m)})
end
end
def check_acl(message)
shared[:acl].check(message, self)
2012/07/11 20:28:02 * You inflict 1477 (1477) points of magic damage on Roaring Torbak.
2012/07/11 20:28:02 * You inflict 1477 (1477) points of magic damage on Gruff Mektoub.
2012/07/11 20:28:02 * You inflict 243 (1477) points of magic damage on Roaring Torbak.
2012/07/11 20:28:02 * You inflict 1034 (1477) points of magic damage on Gruff Rendor.
module Cinch
module Plugins
class PluginManagement
include Cinch::Plugin
match(/plugin load (\S+)(?: (\S+))?/, method: :load_plugin)
match(/plugin unload (\S+)/, method: :unload_plugin)
match(/plugin reload (\S+)(?: (\S+))?/, method: :reload_plugin)
match(/plugin set (\S+) (\S+) (.+)$/, method: :set_option)
def load_plugin(m, plugin, mapping)
@dominikh
dominikh / run.rb
Created May 27, 2011 13:05 — forked from basicxman/run.rb
Extended Mind, Wikipedia Philosophy Checker inspired by http://xkcd.com/903 alt text
#!/usr/bin/env ruby
# Extended Mind
# Wikipedia checker, the concept is that for any Wikipedia article you can
# eventually get to the article on Philosophy if you click the first link
# on the article.
# http://xkcd.com/903 (see alt text)
require 'open-uri'
require 'nokogiri'
require 'benchmark'
var = "a_string"
TIMES = 1_000_000
Benchmark.bmbm do |x|
x.report("//") do
TIMES.times { /a#{var}b/ }
end
# note: this regexp will only be built once for all iterations
require 'benchmark'
TIMES = 1_000_000
s = "a string"
Benchmark.bmbm do |x|
x.report("delete") do
TIMES.times { s.delete("rin") }
end
require 'benchmark'
TIMES = 1_000_000
s = "a string"
Benchmark.bmbm do |x|
x.report("delete") do
TIMES.times { s.delete(" ") }
end
require 'benchmark'
TIMES = 1_000_000
r = /regexp/
s = "regexp"
Benchmark.bmbm do |x|
x.report("r =~ s") do
TIMES.times { r =~ s }