Skip to content

Instantly share code, notes, and snippets.

View argent-smith's full-sized avatar
🐪
OCaml & Coq while not @ work

Pavel Argentov argent-smith

🐪
OCaml & Coq while not @ work
View GitHub Profile
@argent-smith
argent-smith / mkdomains_idn_master
Created November 13, 2010 15:45
a ruby script to generate IDN BIND configuration
#!/usr/bin/env ruby18
#
# == IDN zone generator
#
# = Usage:
#
# $ mkdomains_idn крутой.домен.рф ...
#
# = What does it do?
#
@argent-smith
argent-smith / Rakefile
Created April 9, 2011 07:53
An example of Rakefile of a Jekyll site which sets LANG before doing site generation.
require 'rubygems'
require 'rake'
require 'rake/clean'
require 'rake/gempackagetask'
require 'rake/testtask'
LANG = "ru_RU.UTF-8"
SET_CMD = case RUBY_PLATFORM
when /mingw32/ then "set"
@argent-smith
argent-smith / bug'o'feature_1.md
Created April 14, 2011 17:06
What happened to a file descriptor and how to cure it

Yesterday I've encountered a sudden bug: my four years old script rafused to work. After a slight rewrite I got some kind of descriptive symptom in the syslog:

Fatal: Bad file descriptor 
/usr/local/lib/ruby/gems/1.8/gems/deprecated-2.0.1/lib/deprecated.rb:199:in `write'
/usr/local/lib/ruby/gems/1.8/gems/deprecated-2.0.1/lib/deprecated.rb:199     
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'  
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' 
/usr/local/lib/ruby/site_ruby/1.8/dbi.rb:48 
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' 
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' /usr/work/flow-tools/flow-pg_import:13
@argent-smith
argent-smith / xmlto.md
Created May 10, 2011 08:29
Getting rid of the mystic FreeBSD 'xmlto bug'

Often in the last year I (and other experienced FreeBSD users) face the same problem: "Error loading external entity" messages and thus, the compilation failure.

I've found several ways to fix it and the likes:

  • You should open /usr/local/bin/xmlto script and comment out the following line:

    XSLTOPTS="$XSLTOPTS --nonet"
    

The fix works only if you've got a live Internet connection. The best way probably is to fix local dtd catalogue layout for docbook* things but I still don't know how; advise needed!

@argent-smith
argent-smith / gist:1014283
Created June 8, 2011 11:53
rubinus tests failed on FreeBSD
We couldn’t find that file to show.
@argent-smith
argent-smith / fail.txt
Created June 9, 2011 09:35
new spec fails following #982
bin/mspec ci --background --agent
rubinius 1.2.4dev (1.8.7 842e37c4 yyyy-mm-dd JI) [i386-unknown-freebsd8.2]
............................................................................................................................................
1)
An exception occurred during: after :each
Socket::IPSocket#peeraddr returns an IP instead of hostname if do_not_reverse_lookup is true ERROR
Errno::ECONNRESET: Connection reset by peer
IO(TCPSocket)#close at kernel/common/io.rb:1766
{ } in Object#__script__ at spec/ruby/library/socket/ipsocket
/peeraddr_spec.rb:16
@argent-smith
argent-smith / thin-win.markdown
Created June 11, 2011 05:36
thin installation on 1.9.2/mingw32 (uname => Vista) :)))

How to Avoid an Hour of Trouble Installing Thin on Win

  1. Install RubyInstaller's 1.9.2
  2. Install devkit (https://github.com/oneclick/rubyinstaller/wiki/Development-Kit)
  3. gem install win32-events --platform=ruby (not actually necessary but this pulls up some useful libs for further dev process)
  4. gem install eventmachine --pre --platform=ruby
  5. gem install thin --platform=ruby
@argent-smith
argent-smith / how-to.markdown
Created August 17, 2011 10:21
ruby 1.9.2 installation WITH ICONV under rvm and FreeBSD

Ruby 1.9.2 RVM w/iconv FreeBSD installation HOWTO

The Problem

Recently, trying to run some of my crutches (the Ruby thingies I use to help me sysadmining) under RVM, I've found that require 'iconv' doesn't work. Since I knew it's working in standard lang/ruby18 and lang/ruby19 ports I started to search where is the trap and have found that. Here's how.

Prerequisites

  • rvm installed
  • system ruby installed
@argent-smith
argent-smith / libmap.conf
Created August 23, 2011 17:42
`kse_create() failed` fix (when upgrading FreeBSD < 8.0 to 8.x)
libpthread.so.1 libthr.so.1
libpthread.so.2 libthr.so.2
libkse.so.3 libthr.so.3
@argent-smith
argent-smith / stopwatch.rb
Created August 25, 2011 14:35
Externap program execution stopwatch
#!/usr/bin/env ruby
EXTERNAL=ARGV.join " "
puts "Running #{EXTERNAL}"
t1 = Time.now
system EXTERNAL
t2 = Time.now