Skip to content

Instantly share code, notes, and snippets.

@bosko
bosko / Open in Emacs registry entry
Created February 17, 2009 09:49
Shell extension for "Open In Emacs" pop upmenu
REGEDIT4
[HKEY_CLASSES_ROOT\*\Shell\Open In Emacs]
[HKEY_CLASSES_ROOT\*\Shell\Open In Emacs\Command]
@="c:\\Utils\\emacs-22.3\\bin\\emacsclientw.exe -n \"%1\""
@bosko
bosko / persisting_windows_environment_variables.rb
Created August 28, 2009 13:17
A way to change environment variables in Windows and notify processes about change.
# Not my idea. Don't remember where I've picked it up.
# Just stored here for future reference.
require 'win32/registry.rb'
require 'Win32API'
Win32::Registry::HKEY_CURRENT_USER.open('Environment', Win32::Registry::KEY_WRITE) do |reg|
reg['my_value'] = '123'
end
@bosko
bosko / mssql_list_databases.rb
Created February 24, 2010 11:26
List Databases
require 'activerecord-sqlserver-adapter'
ActiveRecord::Base.establish_connection(
:adapter => 'sqlserver',
:mode => 'ODBC',
:host => '<server>',
:username => '<user_name>',
:password => '<pass>'
:dsn => '<odbc_dsn_name>'
)
@bosko
bosko / Ruby 1.9.2 rake error
Created August 10, 2010 09:58
Ruby 1.9.2 rake error
d:\projects>pik rake --version
ruby 1.8.6 (2010-02-04 patchlevel 398) [i386-mingw32]
rake, version 0.8.7
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]
rake, version 0.8.7
ruby 1.9.2dev (2010-07-11) [i386-mingw32]
@bosko
bosko / 0001-Load-win32console-on-startup.patch
Created September 14, 2010 11:52
RSpec load win32console on start
From f9aa9934e53446e281ed8b054c984d8e314050f5 Mon Sep 17 00:00:00 2001
From: Bosko Ivanisevic <bosko.ivanisevic@gmail.com>
Date: Tue, 14 Sep 2010 13:41:06 +0200
Subject: [PATCH] Load win32console on startup
At the time color option is set, wrong IO objects are configured
for error and output streams. Win32console must be loaded before
run is called in order to get coloured output on MS Windows.
---
bin/rspec | 6 ++++++
From 9037f152c9ae2f1f473a926b65b2647ca7730d27 Mon Sep 17 00:00:00 2001
From: Bosko Ivanisevic <bosko.ivanisevic@gmail.com>
Date: Fri, 17 Sep 2010 11:55:35 +0200
Subject: [PATCH] Fix using Selenium on mingw based Ruby on Windows
---
lib/webrat/selenium/selenium_rc_server.rb | 6 +++---
lib/webrat/selenium/silence_stream.rb | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
@bosko
bosko / GemList_one_liner
Created January 18, 2011 14:07
List all installed gems without versions
ruby -e "%x[gem list].split(\"\n\").each{|l| puts l.split(' ')[0]}"
@bosko
bosko / gist:948043
Created April 29, 2011 08:23
How to compile conftest for Tcl/Tk Ruby extension
gcc -o conftest -Ic:/Ruby/192/include/ruby-1.9.1/i386-mingw32 -Ic:/Ruby/192/include/ruby-1.9.1/ruby/backward -Ic:/Ruby/192/include/ruby-1.9.1 -
I../../../../../ruby-git/ext/tk -I../../../tcl//include -I../../../tk/include -I../../../tcl//include -I../../../tk/include -O3 -g -Wextra -Wno-unu
sed-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long conftest.c -L. -Lc:/Ruby/192/lib -L../..
/../tcl//lib -L../../../tk/lib -L. -ltcl85s -lmsvcrt-ruby191-static -ltk85s -ltcl85s -lshell32 -lws2_32 -lgdi32 -lcomctl32 -limm32 -lole32 -lolea
ut32 -luuid -lcomdlg32
@bosko
bosko / gist:964358
Created May 10, 2011 12:10
x64 build error
cd sandbox/ruby19_build
make
x86_64-w64-mingw32-gcc -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -I. -I.ext/include/x86_64-mingw32 -I../ruby_1_9/include -I../ruby_1_9 -DRUBY_EXPORT -o main.o -c ../ruby_1_9/main.c
In file included from ../ruby_1_9/include/ruby/defines.h:205:0,
from ../ruby_1_9/include/ruby/ruby.h:74,
from ../ruby_1_9/include/ruby.h:32,
from ../ruby_1_9/main.c:13:
../ruby_1_9/include/ruby/win32.h:182:0: warning: "_stati64" redefined
d:/projects/ruby/rubyinstaller/sandbox/devkit/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/sys/stat.h:71:0: note: this is the location of the previous definition
../ruby_1_9/include/ruby/win32.h:181:17: warning: 'struct _stati64' declared inside parameter list
@bosko
bosko / gist:967258
Created May 11, 2011 20:23
End of building shared Tk
ar cr libtkstub85.a tkStubLib.o ttkStubLib.o
ranlib libtkstub85.a
gcc -c -O2 -fomit-frame-pointer -Wall -I"tk8.5.9/win/../generic" -I"tk8.5.9/win" -I"tk8.5.9/win/../xlib" -I"tk8.5.9/win/../bitmaps" -I"/d/projects/ruby/rubyinstaller/sandbox/src-tcl/tcl8.5.9/generic" -I"/d/projects/ruby/rubyinstaller/sandbox/src-tcl/tcl8.5.9/win" -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_UXTHEME_H=1 -DTCL_CFG_OPTIMIZED=1 -DTCL_CFG_DEBUG=1 -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_NO_SEH=1 -DEXCEPTION_DISPOSITION=int -DHAVE_WINNT_IGNORE_VOID=1 -DHAVE_ALLOCA_GCC_INLINE=1 -DHAVE_CAST_TO_UNION=1 -DTCL_CFGVAL_ENCODING=\"cp1252\" -DHAVE_SYS_TYPES_H=1 -DHAVE_SY