Module: Roebe::CustomMethods
- Includes:
- Colours::HtmlColoursMethods
- Defined in:
- lib/roebe/custom_methods/module.rb,
lib/roebe/custom_methods/constants.rb
Overview
Roebe::CustomMethods
Constant Summary collapse
- PI =
#
PI
#
Math::PI
- EINE_MINUTE =
#
EINE_MINUTE
#
60
- EINE_STUNDE =
#
EINE_STUNDE
#
60 * 60
- HASH =
#
HASH
#
{ 'b' => 2, 'a' => 1, 'c' => 3, 'e' => 5, 'd' => 4, 'j' => 7, 'i' => 7, 'FgH' => 6 }
- ARRAY =
#
Define a few global variables next:
#
[ '1','2','3','4','5','6','7','8','9','0', 'a','b','c','d','e', 'abc','cat','dog', 'a','a','b',nil,nil ]
- ALPHABET =
#
ALPHABET
#
('a'..'z').to_a
- STRING =
#
STRING
#
'random line:'
- HOME_DIRECTORY_OF_USER_X =
#
HOME_DIRECTORY_OF_USER_X
#
'/home/x/'
Class Method Summary collapse
-
.autosource ⇒ Object
# === Roebe::CustomMethods.autosource.
-
.create_array_available_local_images ⇒ Object
# === Roebe::CustomMethods.create_array_available_local_images ========================================================================= #.
-
.create_lua_pc_file ⇒ Object
# === Roebe::CustomMethods.create_lua_pc_file ========================================================================= #.
-
.e(i = '') ⇒ Object
# === Roebe::CustomMethods.e ========================================================================= #.
-
.enable_roebe_prompt ⇒ Object
# === Roebe::CustomMethods.enable_roebe_prompt ========================================================================= #.
-
.feedback_which_ruby_version_is_in_use ⇒ Object
# === Roebe::CustomMethods.feedback_which_ruby_version_is_in_use.
-
.ocra_build(on_this_file = 'examples/control_gallery.rb', name_of_the_output_exe = 'control_gallery.exe') ⇒ Object
# === Roebe::CustomMethods.ocra_build (ocra tag, orca tag).
-
.require_my_custom_addons ⇒ Object
# === Roebe::CustomMethods.require_my_custom_addons (require tag, requires tag).
-
.rev ⇒ Object
# === Roebe::CustomMethods.rev ========================================================================= #.
-
.ruby_feature(id = ARGV.first) ⇒ Object
# === ruby_feature ========================================================================= #.
-
.show_the_irb_history ⇒ Object
# === Roebe::CustomMethods.show_the_irb_history.
Instance Method Summary collapse
-
#aa?(optional_sequence = nil) ⇒ Boolean
# === aa?.
-
#abb ⇒ Object
# === abb ========================================================================= #.
-
#abc(inp = 1) ⇒ Object
# === abc ========================================================================= #.
-
#add_ascii_suffix ⇒ Object
# === add_ascii_suffix ========================================================================= #.
-
#add_comment(i = 76) ⇒ Object
# === add_comment ========================================================================= #.
-
#add_current_symlink_to_every_entry_under_programs ⇒ Object
# === add_current_symlink_to_every_entry_under_programs.
-
#add_magnet_links ⇒ Object
# === add_magnet_links.
-
#add_to_playlist(i = ARGV) ⇒ Object
# === add_to_playlist ========================================================================= #.
-
#all_dirs(i = '*') ⇒ Object
# === all_dirs.
-
#all_files(padding = ' ') ⇒ Object
# === all_files ========================================================================= #.
-
#alphabet_to_number(your_string) ⇒ Object
# === alphabet_to_number.
-
#append_help(i = 'normalize') ⇒ Object
# === append_help ========================================================================= #.
-
#ascii ⇒ Object
# === ascii ========================================================================= #.
-
#ascii_alphabet ⇒ Object
# === ascii_alphabet.
-
#ask_a_question_based_on_this_pwdstud_entry(this_position = 1) ⇒ Object
# === ask_a_question_based_on_this_pwdstud_entry.
-
#autoinclude ⇒ Object
# === autoinclude.
-
#autostart ⇒ Object
(also: #kde_autostart)
# === autostart .
-
#avg(i = ARGV, display_result = true) ⇒ Object
(also: #average, #mean)
# === avg.
-
#avinfo(file = '') ⇒ Object
# === avinfo.
-
#backup_kde ⇒ Object
# === backup_kde.
-
#bash ⇒ Object
# === bash ========================================================================= #.
-
#batch_create_files ⇒ Object
# === batch_create_files.
-
#benchmark_prototype ⇒ Object
# === benchmark_prototype.
-
#binary(i) ⇒ Object
# === binary.
-
#bit? ⇒ Boolean
# === bit? ========================================================================= #.
-
#boku? ⇒ Boolean
# === boku? ========================================================================= #.
-
#border? ⇒ Boolean
# === border?.
-
#build_all_my_local_gems ⇒ Object
# === build_all_my_local_gems ========================================================================= #.
-
#bundle_exam_results ⇒ Object
(also: #bundle_exams)
# === bundle_exam_results.
-
#calculate_sum_for_excel(start_number = 4, up_to = 128, array = %w( I J K )) ⇒ Object
# === calculate_sum_for_excel ========================================================================= #.
-
#cat(i = ARGV) ⇒ Object
# === cat ========================================================================= #.
-
#ccc ⇒ Object
# === ccc ========================================================================= #.
-
#chance(base_chance = 25) ⇒ Object
# === chance.
-
#change_all_entries_for_today ⇒ Object
# === change_all_entries_for_today ========================================================================= #.
-
#chdir(i = '/Depot/Temp') ⇒ Object
(also: #cd)
# === chdir (chdir tag).
-
#chmod?(i = ARGV, output_result = true) ⇒ Boolean
# === chmod? ========================================================================= #.
-
#chunker(f_in, out_pref, chunksize = (1_073_741_824 / 1024.0)) ⇒ Object
# === chunker.
-
#close ⇒ Object
(also: #clo)
# === close ========================================================================= #.
-
#clr ⇒ Object
(also: #clear)
# === clr.
-
#colour_to_hex(i = ARGV) ⇒ Object
# === colour_to_hex ========================================================================= #.
-
#colourized_method(input = '', colour = 'green', make_newline = true, print_result = true) ⇒ Object
(also: #cme, #cm)
# === colourized_method (cme tag colme tag).
-
#compile(this_program = 'php5') ⇒ Object
(also: #comp, #ry)
# === compile.
-
#compile_as_appdir(i = return_pwd) ⇒ Object
(also: #compile_into_appdir)
# === compile_as_appdir (appconf, appdir).
-
#compile_into_xfce_prefix ⇒ Object
# === compile_into_xfce_prefix.
-
#compile_these(these = ARGV) ⇒ Object
# === compile_these.
-
#completion(dataset = nil) ⇒ Object
# === completion.
-
#configure_magic ⇒ Object
(also: #configuremagic)
# === configure_magic ========================================================================= #.
-
#copy_cookbook_files_into_ruby_cookbooks_directory ⇒ Object
# === copy_cookbook_files_into_ruby_cookbooks_directory.
-
#copy_file(file, where_to = return_pwd) ⇒ Object
(also: #copy)
# === copy_file (copy tag).
-
#cpp_header? ⇒ Boolean
# === cpp_header? ========================================================================= #.
-
#cpruby ⇒ Object
# === cpruby ========================================================================= #.
-
#cpu? ⇒ Boolean
(also: #cpu)
# === cpu?.
-
#create_benchmark_file ⇒ Object
# === create_benchmark_file ========================================================================= #.
-
#create_database ⇒ Object
# === create_database.
-
#create_directories ⇒ Object
# === create_directories ========================================================================= #.
-
#create_directory(i) ⇒ Object
(also: #mkdir)
# === create_directory.
-
#create_file(i = '') ⇒ Object
(also: #touch)
# === create_file.
-
#create_image_collection ⇒ Object
# === create_image_collection.
-
#create_individual_file(array) ⇒ Object
# === create_individual_file.
-
#create_lua_pc_file ⇒ Object
# === create_lua_pc_file ========================================================================= #.
-
#create_njoy_page ⇒ Object
# === create_njoy_page.
-
#create_rpm_dirs ⇒ Object
# === create_rpm_dirs ========================================================================= #.
-
#create_these_files_and_open_them(also_open_these_files = false) ⇒ Object
# === create_these_files_and_open_them ========================================================================= #.
-
#cropdetect(i = ARGV.first) ⇒ Object
# === cropdetect.
-
#css_comments? ⇒ Boolean
(also: #css_hints)
# === css_comments?.
-
#csv(i = 'trees91.csv') ⇒ Object
# === csv.
-
#custom_parse_this_XML_file_and_extract_email_contact_information(i = '/Depot/j/CONTACTS/') ⇒ Object
# === custom_parse_this_XML_file_and_extract_email_contact_information.
-
#custom_prompt ⇒ Object
(also: #my_prompt, #myprompt)
# === custom_prompt ========================================================================= #.
-
#cyberweb ⇒ Object
(also: #cyber, #web_object)
# === cyberweb ========================================================================= #.
-
#date ⇒ Object
# === date.
-
#default ⇒ Object
# === default ========================================================================= #.
-
#delete_all_directories_from_this_directory ⇒ Object
# === delete_all_directories_from_this_directory.
-
#delete_all_empty_directories_from_this_directory ⇒ Object
# === delete_all_empty_directories_from_this_directory.
-
#delete_file(i) ⇒ Object
(also: #remove_file, #del)
# === delete_file ========================================================================= #.
-
#dia ⇒ Object
# === dia ========================================================================= #.
-
#dir(which_files = 'tar.bz2') ⇒ Object
(also: #glob)
# === dir.
-
#dirs? ⇒ Boolean
# === dirs?.
-
#disable_input ⇒ Object
# === disable_input.
-
#display_battery ⇒ Object
# === display_battery ========================================================================= #.
-
#display_help_for_wurzel_ziehen ⇒ Object
# === display_help_for_wurzel_ziehen ========================================================================= #.
-
#divide(*args) ⇒ Object
# === divide.
-
#do_pid(create_this_directory = '/Depot/dir_created_as_some_user/') ⇒ Object
# === do_pid.
-
#dolphin ⇒ Object
# === dolphin.
-
#dosbox_config(i = ARGV) ⇒ Object
# === dosbox_config.
-
#download(this_url = ARGV.first) ⇒ Object
# === download.
-
#download_favicon(this_url = 'https://www.ruppweb.org/Xray/101index.html') ⇒ Object
# === download_favicon.
-
#download_llvm_stuff ⇒ Object
# === download_llvm_stuff ========================================================================= #.
-
#druby(i = '9000') ⇒ Object
# === druby.
-
#dump_all_my_gems ⇒ Object
# === dump_all_my_gems.
-
#e(i = '') ⇒ Object
# === e ========================================================================= #.
-
#eject ⇒ Object
(also: #eje)
# === eject ========================================================================= #.
-
#enable_auto_login ⇒ Object
# === enable_auto_login.
-
#enable_autoindent ⇒ Object
# === enable_autoindent.
-
#enable_input ⇒ Object
# === enable_input ========================================================================= #.
-
#enable_my_firefox_profile ⇒ Object
# === enable_my_firefox_profile.
-
#enable_nano_config ⇒ Object
(also: #generate_nano_config)
# === enable_nano_config.
-
#encodings? ⇒ Boolean
# === encodings?.
-
#env ⇒ Object
# === env.
-
#esystem(i) ⇒ Object
# === esystem ========================================================================= #.
-
#extract(i) ⇒ Object
(also: #ext)
# === extract.
-
#extract_url(url_string = ARGV.first) ⇒ Object
# === extract_url.
-
#extract_what_to(what, to = return_pwd) ⇒ Object
# === extract_what_to.
-
#fancy_irb ⇒ Object
(also: #fancyirb, #firb)
# === fancy_irb ========================================================================= #.
-
#features ⇒ Object
(also: #fe)
# === features ========================================================================= #.
-
#feedback_base_class ⇒ Object
# === feedback_base_dir.
-
#feedback_base_dir ⇒ Object
(also: #base_project?)
# === feedback_base_dir ========================================================================= #.
-
#feedback_help_about_raise ⇒ Object
# === feedback_help_about_raise ========================================================================= #.
-
#feedback_ruby_keywords ⇒ Object
# === feedback_ruby_keywords.
-
#fetch_gimp ⇒ Object
(also: #update_gimp)
# === fetch_gimp.
-
#fetch_page(which_page = 'http://www.google.at') ⇒ Object
(also: #fet, #www_open, #open_www)
# === fetch.
-
#fib(input = 10) ⇒ Object
# === fib.
-
#fibonacci(i = ARGV.first) ⇒ Object
# === fibonacci.
-
#file_ending(i = ARGV.first) ⇒ Object
# === file_ending ========================================================================= #.
-
#fill_up_with_this_token(amount = 10, my_token = ' ') ⇒ Object
# === fill_up_with_this_token ========================================================================= #.
-
#filter_ansi(i) ⇒ Object
(also: #fansi)
# === filter_ansi.
-
#find_duplicates ⇒ Object
# === find_duplicates.
-
#find_object(the_object_id) ⇒ Object
# === find_object.
-
#find_primes ⇒ Object
(also: #primes?)
# === find_primes.
-
#find_rdoc_docu(i = ARGV.first, format_type = '--format=markdown') ⇒ Object
# === find_rdoc_docu.
-
#fix_filenames ⇒ Object
# === fix_filenames.
-
#fix_pidgin ⇒ Object
(also: #fix_icq)
# === fix_pidgin.
-
#fsize(file = '/Depot/Temp/Multiaterm.desktop') ⇒ Object
# === fsize ========================================================================= #.
-
#fstat(file = '/index.php') ⇒ Object
# === fstat ========================================================================= #.
-
#gem_install ⇒ Object
# === gem_install ========================================================================= #.
-
#gem_install_script ⇒ Object
# === gem_install_script.
-
#gemi(i) ⇒ Object
# === gemi.
-
#generate_cookbooks_completions ⇒ Object
# === generate_cookbooks_completions.
-
#generate_html_table_for_individuelles_curriculum ⇒ Object
# === generate_html_table_for_individuelles_curriculum ========================================================================= #.
-
#generate_lighttpd_configuration ⇒ Object
# === generate_lighttpd_configuration ========================================================================= #.
-
#generate_opal_files ⇒ Object
# === generate_opal_files.
-
#generate_random_chars(how_many = 25) ⇒ Object
# === generate_random_chars.
-
#generate_random_numbers(n_times = 10, range = (0..100).to_a) ⇒ Object
# === generate_random_numbers.
-
#generate_random_string(len = 1_000, shall_we_output_the_result = true) ⇒ Object
(also: #random_string, #gsr)
# === generate_random_string.
-
#generate_rf_completions ⇒ Object
# === generate_rf_completions.
-
#get_random_image ⇒ Object
# === get_random_image.
-
#getch ⇒ Object
# === getch ========================================================================= #.
-
#girls ⇒ Object
# === girls ========================================================================= #.
-
#git_colours ⇒ Object
# === git_colours ========================================================================= #.
-
#google_search(search_term = 'ruby') ⇒ Object
# === google_search ========================================================================= #.
-
#gtk ⇒ Object
(also: #gtk2)
# === gtk ========================================================================= #.
-
#gtk_runner? ⇒ Boolean
# === gtk_runner?.
-
#has_readline? ⇒ Boolean
# === has_readline?.
-
#heredocs? ⇒ Boolean
# === heredocs? (eof tag).
-
#histogramm(*i) ⇒ Object
(also: #histogram)
# === histogramm.
-
#htmlentities(i) ⇒ Object
# === htmlentities.
-
#images_to_html(from_this_directory = return_pwd) ⇒ Object
(also: #imagestohtml)
# === images_to_html ========================================================================= #.
-
#increase_volume(i) ⇒ Object
# === increase_volume ========================================================================= #.
-
#install_acrobat_reader ⇒ Object
# === install_acrobat_reader.
-
#install_and_update_rcfiles ⇒ Object
# === install_and_update_rcfiles ========================================================================= #.
-
#install_bcm4318 ⇒ Object
(also: #install_bcm)
# === install_bcm4318.
-
#install_docbook_components ⇒ Object
# === install_docbook_components.
-
#install_geany_addons ⇒ Object
# === install_geany_addons.
-
#install_in_ruby_gem_manner(optional_copy_the_gem_to_this_location = nil) ⇒ Object
# === install_in_ruby_gem_manner ========================================================================= #.
-
#install_in_ruby_setup_manner ⇒ Object
(also: #r2)
# === install_in_ruby_setup_manner.
-
#install_java ⇒ Object
(also: #installjava)
# === install_java.
-
#install_lampp ⇒ Object
# === install_lampp ========================================================================= #.
-
#install_my_gems ⇒ Object
# === install_my_gems.
-
#install_openoffice ⇒ Object
(also: #openoffice, #install_libreoffice, #ioffice)
# === install_openoffice (openoffice tag, ooffice tag, roffice).
-
#install_opera ⇒ Object
# === install_opera.
-
#install_postgresql ⇒ Object
# === install_postgresql.
-
#install_roebe_addons ⇒ Object
# === install_roebe_addons ========================================================================= #.
-
#install_this_deb_file(deb_file) ⇒ Object
# === install_this_deb_file.
-
#install_usb_tv ⇒ Object
# === install_usb_tv ========================================================================= #.
-
#install_wg111t ⇒ Object
(also: #wlan)
# === install_wg111t.
-
#install_xfce ⇒ Object
# === install_xfce.
-
#install_youtube_dl ⇒ Object
# === install_youtube_dl.
-
#invoke_capitalize(name = ARGV.first) ⇒ Object
# === rinvoke invoke_capitalize ========================================================================= #.
-
#ip?(this_www_address = 'www.ruby-lang.org') ⇒ Boolean
# === ip? ========================================================================= #.
-
#is_image_file?(i) ⇒ Boolean
# == is_image_file? ========================================================================= #.
-
#is_on_roebe? ⇒ Boolean
# === is_on_roebe? ========================================================================= #.
-
#iso_encoding(i) ⇒ Object
# === iso_encoding ========================================================================= #.
-
#javascriptcomment? ⇒ Boolean
# === javascriptcomment? ========================================================================= #.
-
#json(i = nil) ⇒ Object
# === json ========================================================================= #.
-
#json_to_hash(from_this_file) ⇒ Object
# === json_to_hash.
-
#keywords? ⇒ Boolean
# === keywords? ========================================================================= #.
-
#kill_la_files ⇒ Object
# === kill_la_files.
-
#less(*args) ⇒ Object
# === less.
-
#liner(n_times = 80) ⇒ Object
(also: #cliner)
# === liner ========================================================================= #.
-
#link?(i = ARGV) ⇒ Boolean
# === link? ========================================================================= #.
-
#ll ⇒ Object
(also: #l, #showdir, #ls)
# === ll (ll tag, ls tag, l tag) ========================================================================= #.
-
#load_path? ⇒ Boolean
# === load_path?.
-
#load_wirble ⇒ Object
# === load_wirble.
-
#main_test(i = ARGV) ⇒ Object
(also: #test2)
# === main_test.
-
#make_cookbooks_gem ⇒ Object
# === make_cookbooks_gem.
-
#make_gem ⇒ Object
# === make_gem ========================================================================= #.
-
#make_pdf ⇒ Object
# === make_pdf.
-
#manual ⇒ Object
# === manual ========================================================================= #.
-
#married ⇒ Object
# === married ========================================================================= #.
-
#married_with_children ⇒ Object
# === married_with_children ========================================================================= #.
-
#mbr? ⇒ Boolean
# === mbr?.
-
#mechanize ⇒ Object
# === mechanize ========================================================================= #.
-
#meduni? ⇒ Boolean
# === meduni? ========================================================================= #.
-
#mem?(i) ⇒ Boolean
# === mem? ========================================================================= #.
-
#merge_via_prawn ⇒ Object
# === merge_via_prawn.
-
#methods?(from_this_module = Roebe) ⇒ Boolean
# === methods?.
-
#mini_fix_libtool_files ⇒ Object
# === mini_fix_libtool_files.
-
#misc ⇒ Object
# === misc (misc tag).
-
#mixed_case(i) ⇒ Object
# === mixed_case ========================================================================= #.
-
#moleculargewicht(i) ⇒ Object
# === moleculargewicht ========================================================================= #.
-
#month ⇒ Object
# === month.
-
#mp3_to_ogg(i = ARGV) ⇒ Object
# === mp3_to_ogg ========================================================================= #.
-
#multi_ascii_splitter(char_limit, *args) ⇒ Object
(also: #mas)
# === multi_ascii_splitter ========================================================================= #.
-
#mv(old_file, new_file, be_verbose = false) ⇒ Object
(also: #move_file)
# === mv (mv tag) ========================================================================= #.
-
#my_sym(target_location = ) ⇒ Object
# === my_sym.
-
#n_words(from_this_file = ARGV) ⇒ Object
# === n_words.
-
#nano_addons ⇒ Object
# === nano_addons ========================================================================= #.
-
#ndirs?(i = Dir.pwd, output_result = true) ⇒ Boolean
# === ndirs?.
-
#newstud10 ⇒ Object
# === newstud10 ========================================================================= #.
-
#newstud11 ⇒ Object
# === newstud11 ========================================================================= #.
-
#newstud12 ⇒ Object
# === newstud12 ========================================================================= #.
-
#newstud13 ⇒ Object
# === newstud13 ========================================================================= #.
-
#newstud14 ⇒ Object
# === newstud14 ========================================================================= #.
-
#newstud15 ⇒ Object
# === newstud15 ========================================================================= #.
-
#newstud16 ⇒ Object
# === newstud16 ========================================================================= #.
-
#newstud17 ⇒ Object
# === newstud17 ========================================================================= #.
-
#newstud18 ⇒ Object
# === newstud18 ========================================================================= #.
-
#newstud19 ⇒ Object
# === newstud19 ========================================================================= #.
-
#newstud2 ⇒ Object
# === newstud2 ========================================================================= #.
-
#newstud20 ⇒ Object
# === newstud20 ========================================================================= #.
-
#newstud3 ⇒ Object
# === newstud3.
-
#newstud4 ⇒ Object
# === newstud4.
-
#newstud5 ⇒ Object
# === newstud5.
-
#newstud6 ⇒ Object
# === newstud6 ========================================================================= #.
-
#newstud7 ⇒ Object
# === newstud7 ========================================================================= #.
-
#newstud8 ⇒ Object
# === newstud8 ========================================================================= #.
-
#newstud9 ⇒ Object
# === newstud9 ========================================================================= #.
-
#no_audio(file = ARGV.first) ⇒ Object
# === no_audio ========================================================================= #.
-
#non_ascii ⇒ Object
# === non_ascii.
-
#objects? ⇒ Boolean
# === objects?.
-
#odd_or_even(i) ⇒ Object
# === odd_or_even.
-
#opal(i) ⇒ Object
# === opal ========================================================================= #.
-
#open? ⇒ Boolean
(also: #ports?)
# === open?.
-
#open_in_browser(i = ARGV) ⇒ Object
# === open_in_browser ========================================================================= #.
-
#open_in_editor(i = ARGV) ⇒ Object
# === open_in_editor (open tag).
-
#opnn ⇒ Object
# === opnn ========================================================================= #.
-
#optionparser? ⇒ Boolean
# === optionparser? ========================================================================= #.
-
#output_array_from_beautiful_menu ⇒ Object
# rinvoke output_array_from_beautiful_menu ========================================================================= #.
-
#pathname ⇒ Object
# === pathname ========================================================================= #.
-
#pexit(*args) ⇒ Object
# === pexit.
-
#pid ⇒ Object
# === pid ========================================================================= #.
-
#ping(i) ⇒ Object
# === ping ========================================================================= #.
-
#play(i) ⇒ Object
# === play ========================================================================= #.
-
#play_columbo_files(use_this_base_directory = :default, play_n_files = ARGV.first) ⇒ Object
(also: #columbo)
# === play_columbo_files.
-
#play_midi(i = HOME_DIRECTORY_OF_USER_X+'DATA/AUDIO/MIDI/al_adagi.mid') ⇒ Object
# === play_midi.
-
#play_random_simpsons_movie ⇒ Object
(also: #simpson_movie)
# === play_random_simpsons_movie ========================================================================= #.
-
#populate_the_main_ENV_variable_with_data_from_custom_yaml_file ⇒ Object
# === populate_the_main_ENV_variable_with_data_from_custom_yaml_file ========================================================================= #.
-
#port_str ⇒ Object
# === port_str.
-
#ppexit(*args) ⇒ Object
# === ppexit.
-
#prepare_gcc ⇒ Object
# === prepare_gcc.
-
#print_indent_pattern(n_times = 3, use_this_token = '*') ⇒ Object
# === print_indent_pattern.
-
#priv ⇒ Object
# === priv.
-
#process_kill ⇒ Object
# === kill.
-
#pty_spawn ⇒ Object
# === pty_spawn ========================================================================= #.
-
#purge_invalid_yaml_directories_from_programs_hierarchy ⇒ Object
# === purge_invalid_yaml_directories_from_programs_hierarchy ========================================================================= #.
-
#putssystem(i) ⇒ Object
# === putssystem ========================================================================= #.
-
#python_has_bz2? ⇒ Boolean
# === python_has_bz2? ========================================================================= #.
-
#q ⇒ Object
(also: #rda, #qu, #qi, #i)
# === q (q tag, quit tag, Roebe::q).
-
#question1 ⇒ Object
# === question1 ========================================================================= #.
-
#question2 ⇒ Object
# === question2 ========================================================================= #.
-
#question3 ⇒ Object
# === question3 ========================================================================= #.
-
#question4 ⇒ Object
# === question4 ========================================================================= #.
-
#question5 ⇒ Object
# === question5 ========================================================================= #.
-
#rack_handlers? ⇒ Boolean
# === rack_handlers? ========================================================================= #.
-
#rails? ⇒ Boolean
# === rails? ========================================================================= #.
-
#random_number ⇒ Object
# === random_number ========================================================================= #.
-
#range(up_to_this_number = 10, start_number = 1) ⇒ Object
# === range.
-
#raw_dir ⇒ Object
# === raw_dir.
-
#raw_read_line(of_this_file = ARGV.first, line_number = ) ⇒ Object
# === raw_read_line.
-
#raw_readlines(i = nil) ⇒ Object
(also: #read_file, #readfile)
# === raw_readlines.
-
#rbt ⇒ Object
# === rbt ========================================================================= #.
-
#rcfiles(i = ARGV) ⇒ Object
# === rcfiles ========================================================================= #.
-
#readable_int(num) ⇒ Object
# === readable_int.
-
#recursive_method_example(a, b) ⇒ Object
# === recursive_method_example.
-
#register_irc? ⇒ Boolean
# === register_irc? ========================================================================= #.
-
#register_sigint ⇒ Object
# === register_sigint ========================================================================= #.
-
#registered_pipe_actions? ⇒ Boolean
# === registered_pipe_actions? ========================================================================= #.
-
#reject_blanks(input = ARGF.read) ⇒ Object
# === reject_blanks.
-
#remote_file_listing(url = 'http://curl.haxx.se/download/') ⇒ Object
# === remote_file_listing.
-
#remove(i) ⇒ Object
# === remove ========================================================================= #.
-
#remove_all_symlinks ⇒ Object
# === remove_all_symlinks.
-
#remove_numbers(input = 'test123') ⇒ Object
# === remove_numbers ========================================================================= #.
-
#remove_old_gem ⇒ Object
# === remove_old_gem ========================================================================= #.
-
#rename(old, new) ⇒ Object
# === rename (rename tag) ========================================================================= #.
-
#rename_all ⇒ Object
# === rename_all.
-
#rename_ascii_files ⇒ Object
# === rename_ascii_files.
-
#rep(how_many_times) ⇒ Object
# === rep.
-
#replace_double_underscores ⇒ Object
# === replace_double_underscores.
-
#report_pwd ⇒ Object
(also: #pwd?, #pwd)
# === report_pwd ========================================================================= #.
-
#require_opal ⇒ Object
(also: #ropal)
# === require_opal ========================================================================= #.
-
#reset_irb ⇒ Object
# === reset_irb ========================================================================= #.
-
#resize_images_for_my_mom(resize_n_percent = '15') ⇒ Object
# === resize_images_for_my_mom.
-
#restore? ⇒ Boolean
# === restore? ========================================================================= #.
-
#restore_kde ⇒ Object
# === restore_kde.
-
#restore_stdout? ⇒ Boolean
# === restore_stdout? ========================================================================= #.
-
#ret_ftype(file = '') ⇒ Object
# === ret_ftype.
-
#return_pwd ⇒ Object
# === return_pwd ========================================================================= #.
-
#rev ⇒ Object
# === rev ========================================================================= #.
-
#rf(i) ⇒ Object
# === rf ========================================================================= #.
-
#rfeedback(i = ARGV) ⇒ Object
# === rfeedback.
-
#rm(i) ⇒ Object
# === rm (rm tag).
-
#rmax(string = ARGV.first) ⇒ Object
# === rmax.
-
#roebe_festnetz? ⇒ Boolean
# === roebe_festnetz? ========================================================================= #.
-
#roebe_shell(i = ARGV) ⇒ Object
(also: #roebeshell, #shell)
# === roebe_shell ========================================================================= #.
-
#round(i, round_to_n_places = 3) ⇒ Object
# === round ========================================================================= #.
-
#rsong ⇒ Object
# === rsong.
-
#rsplit ⇒ Object
# === rsplit.
-
#ruby_download(i = ARGV) ⇒ Object
# === ruby_download ========================================================================= #.
-
#ruby_header ⇒ Object
# === ruby_header.
-
#ruby_main ⇒ Object
# === ruby_main.
-
#rubycalc(i = ARGV) ⇒ Object
# === rubycalc ========================================================================= #.
-
#rubycol ⇒ Object
(also: #rubycolours)
# === rubycol ========================================================================= #.
-
#run_cfdg ⇒ Object
# === run_cfdg.
-
#sanitize_uptime(inp, language_used = 'german') ⇒ Object
# === sanitize_uptime.
-
#save_all_contacts ⇒ Object
# === save_all_contacts.
-
#save_yaml(i) ⇒ Object
# === save_yaml.
-
#say(i = ARGV) ⇒ Object
# === say.
-
#sdl ⇒ Object
# === sdl ========================================================================= #.
-
#setup_git ⇒ Object
(also: #enable_git)
# === setup_git.
-
#sfancy(i) ⇒ Object
# === sfancy ========================================================================= #.
-
#show_all_256_colours ⇒ Object
# === show_all_256_colours.
-
#show_encoding(i) ⇒ Object
# === show_encoding.
-
#show_exponential_growth ⇒ Object
# === show_exponential_growth ========================================================================= #.
-
#show_fc_list ⇒ Object
# === show_fc_list ========================================================================= #.
-
#show_iso_encoding(i = nil) ⇒ Object
# === show_encoding.
-
#show_regex(input_data, regEx) ⇒ Object
# === show_regex.
-
#show_registered_binaries ⇒ Object
# === show_registered_binaries ========================================================================= #.
-
#show_roebe_festnetz? ⇒ Boolean
# === show_roebe_festnetz? ========================================================================= #.
-
#show_rubylibdir ⇒ Object
# === show_rubylibdir ========================================================================= #.
-
#show_the_irb_history ⇒ Object
(also: #history?)
# === show_the_irb_history.
-
#show_yaml_syntax ⇒ Object
# === show_yaml_syntax.
-
#silence_warnings ⇒ Object
# === silence_warnings.
-
#singularize(i = ARGV) ⇒ Object
# === singularize ========================================================================= #.
-
#size_of_directory(dirname) ⇒ Object
# === size_of_directory.
-
#snoop_on_keylog(input) ⇒ Object
# === snoop_on_keylog.
-
#songlist ⇒ Object
# === songlist ========================================================================= #.
-
#sort_by_highest_price ⇒ Object
# === sort_by_highest_price ========================================================================= #.
-
#sqrt(i = 2) ⇒ Object
# === sqrt.
-
#start_apache ⇒ Object
# === start_apache.
-
#start_baldurs_gate2 ⇒ Object
# === start_baldurs_gate2 ========================================================================= #.
-
#start_lampp ⇒ Object
# === start_lampp ========================================================================= #.
-
#start_lighttpd ⇒ Object
# === start_lighttpd ========================================================================= #.
-
#stat_file(i = ARGV) ⇒ Object
# === stat_file.
-
#std_cfdg ⇒ Object
# === std_cfdg.
-
#steop1 ⇒ Object
# === steop1.
-
#stop_apache ⇒ Object
# === stop_apache.
-
#stop_lampp ⇒ Object
# === stop_lampp ========================================================================= #.
-
#stop_lighty ⇒ Object
(also: #stop_lighttpd)
# === stop_lighty ========================================================================= #.
-
#strip_leading_spaces ⇒ Object
# === strip_leading_spaces.
-
#strip_lowercase ⇒ Object
# === strip_lowercase.
-
#studium ⇒ Object
# === studium ========================================================================= #.
-
#stundenplan? ⇒ Boolean
# === stundenplan?.
-
#switch_to_psych ⇒ Object
(also: #psych)
# === switch_to_psych.
-
#symlink(existing_name, new_name, be_verbose = true) ⇒ Object
(also: #symlink_from_to)
# === symlink (symlink tag, symlink to tag).
-
#symmetrical_renaming_of_files_in_this_directory(i = return_pwd) ⇒ Object
# === symmetrical_renaming_of_files_in_this_directory.
-
#sys(input = 'ls') ⇒ Object
# === sys.
-
#sysbg(inp) ⇒ Object
# === sysbg ========================================================================= #.
-
#system_with_pid(*cmd) {|pid| ... } ⇒ Object
# === system_with_pid.
-
#tabbed_mean(i = ' 1.240 1.490 0.751 0.793 1.420 1.400 1.110 1.260 1.100 0.973 1.420 1.420 0.669 1.080 1.020 1.430 0.986 1.490 1.340 0.804 1.330 1.400 1.170 1.400 1.190 1.620 1.380 1.160 1.320 0.780 1.560 1.310 0.745 1.200 1.070 1.260 ') ⇒ Object
# === tabbed_mean.
-
#terminal? ⇒ Boolean
# === terminal? ========================================================================= #.
-
#test1 ⇒ Object
# === test1 ========================================================================= #.
-
#test_genbank ⇒ Object
# === test_genbank.
-
#test_openssl ⇒ Object
# === test_openssl ========================================================================= #.
-
#the_pid? ⇒ Boolean
# === the_pid?.
-
#this_is_a_test ⇒ Object
# === this_is_a_test ========================================================================= #.
-
#time? ⇒ Boolean
(also: #rubytime?, #rubytime)
# === time? ========================================================================= #.
-
#tinyurl(url_of = 'http://derstandard.at/?url=/?id=3171411') ⇒ Object
# === tinyurl.
-
#to_1000_ECTS ⇒ Object
(also: #to1000)
# === to_1000_ECTS ========================================================================= #.
-
#to_ascii(this_image = ARGV.first) ⇒ Object
# === to_ascii.
-
#to_boolean(value) ⇒ Object
# === to_boolean.
-
#to_current(this_dir = ARGV.first) ⇒ Object
# === to_current.
-
#to_frequency(i = nil) ⇒ Object
(also: #tohash)
# === to_frequency.
-
#to_mp3(i = ARGV) ⇒ Object
# === to_mp3 ========================================================================= #.
-
#to_mp4(i = ARGV) ⇒ Object
# === to_mp4 ========================================================================= #.
-
#to_mpg(file = ARGV.first) ⇒ Object
# === to_mpg.
-
#to_utf(i) ⇒ Object
# === to_utf.
-
#to_webm(i = ARGV) ⇒ Object
# === to_webm ========================================================================= #.
-
#today? ⇒ Boolean
# === today? ========================================================================= #.
-
#try_to_enable_the_expanded_cd_aliases ⇒ Object
# === try_to_enable_the_expanded_cd_aliases ======================================================================== #.
-
#uid(i = 124) ⇒ Object
# === uid.
-
#undone ⇒ Object
# === undone ========================================================================= #.
-
#unicode(i = '271B') ⇒ Object
# === unicode.
-
#uniwien? ⇒ Boolean
# === uniwien? ========================================================================= #.
-
#update(install_how = :both) ⇒ Object
(also: #allruby, #ruby_update)
# === update (iruby tag, update tag).
-
#uri ⇒ Object
# === uri ========================================================================= #.
-
#use(i = ARGV) ⇒ Object
# === use.
-
#use_firefox_for_kde_konsole ⇒ Object
# === use_firefox_for_kde_konsole ========================================================================= #.
-
#utf? ⇒ Boolean
# === utf?.
-
#valid_ISBN?(i = '9783423348478') ⇒ Boolean
# === valid_ISBN? (ISBN tag, isbn tag).
-
#verbose_number(number) ⇒ Object
# === verbose_number.
-
#verbose_truth(i) ⇒ Object
(also: #vt, #yes_no)
# === verbose_truth(true).
-
#view_slackware_packages(also_modify_the_cookbook_files = true) ⇒ Object
# === view_slackware_packages.
-
#wav_to_opus(i = ARGV) ⇒ Object
# === wav_to_opus ========================================================================= #.
-
#webrick ⇒ Object
(also: #wrick, #start_my_webrick, #start_webrick)
# === wrick.
-
#week? ⇒ Boolean
# === week? ========================================================================= #.
-
#welcome ⇒ Object
# === welcome ========================================================================= #.
-
#which_platform? ⇒ Boolean
# === which_platform?.
-
#windows_md5 ⇒ Object
# === windows_md5.
-
#with_captured_stdout ⇒ Object
# === with_captured_stdout ========================================================================= #.
-
#wochentag?(i = ARGV.first) ⇒ Boolean
# === wochentag? (weekday).
-
#wrap(i = '/FILE') ⇒ Object
# === wrap.
-
#write_this_into_file(c, l = 'STORE_INTO_THIS_FILE', mode = 'w+') ⇒ Object
(also: #save)
# === write_this_into_file.
-
#wurzel(i) ⇒ Object
# === wurzel ========================================================================= #.
-
#x1 ⇒ Object
# === x ========================================================================= #.
-
#xchat ⇒ Object
(also: #chat)
# === xchat.
-
#xfce_autostart ⇒ Object
# === xfce_autostart ========================================================================= #.
-
#xml ⇒ Object
# === xml ========================================================================= #.
-
#yam ⇒ Object
# === yam ========================================================================= #.
-
#yaml(this_file) ⇒ Object
# === yaml ========================================================================= #.
Class Method Details
.autosource ⇒ Object
#
Roebe::CustomMethods.autosource
This is a hackish method - it will simply add an alias to the main rc files I use on my home system.
#
5171 5172 5173 5174 5175 5176 5177 |
# File 'lib/roebe/custom_methods/module.rb', line 5171 def self.autosource into = Dir.home.to_s+'/.bashrc' puts 'Storing into `'+into+'`.' append_what_into( ". /AUTOGENERATED/aliases_rc\n", into ) end |
.create_array_available_local_images ⇒ Object
#
Roebe::CustomMethods.create_array_available_local_images
#
3590 3591 3592 3593 |
# File 'lib/roebe/custom_methods/module.rb', line 3590 def self.create_array_available_local_images require 'image_paradise/toplevel_methods/misc.rb' ImageParadise.create_array_available_local_images end |
.create_lua_pc_file ⇒ Object
#
Roebe::CustomMethods.create_lua_pc_file
#
3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 |
# File 'lib/roebe/custom_methods/module.rb', line 3941 def self.create_lua_pc_file into = '/usr/lib/pkgconfig/lua.pc' what = ' V=5.4 R=5.4.3 prefix=/usr INSTALL_BIN=${prefix}/bin INSTALL_INC=${prefix}/include INSTALL_LIB=${prefix}/lib INSTALL_MAN=${prefix}/man/man1 INSTALL_LMOD=${prefix}/share/lua/${V} INSTALL_CMOD=${prefix}/lib/lua/${V} exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: Lua Description: An Extensible Extension Language Version: ${R} Requires: Libs: -L${libdir} -llua -lm Cflags: -I${includedir}' ::Roebe.write_what_into(what, into) puts 'Stored at `'+::Roebe.sfile(into)+'`.' end |
.e(i = '') ⇒ Object
#
Roebe::CustomMethods.e
#
83 84 85 |
# File 'lib/roebe/custom_methods/module.rb', line 83 def self.e(i = '') puts i end |
.enable_roebe_prompt ⇒ Object
#
Roebe::CustomMethods.enable_roebe_prompt
#
3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 |
# File 'lib/roebe/custom_methods/module.rb', line 3662 def self.enable_roebe_prompt # ======================================================================= # # === ROEBE_PROMPT # # Define the ROEBE_PROMPT here. You can invoke it by doing something # like: # # irb --prompt roebe-prompt # # ======================================================================= # IRB.conf[:PROMPT][:ROEBE_PROMPT] = { PROMPT_I: "\n", # A newline is, oddly enough, required here. PROMPT_N: ".. ", # Or: "", PROMPT_S: '"', # Or nil PROMPT_C: '', RETURN: "=> %s\n" } IRB.conf[:PROMPT_MODE] = :ROEBE_PROMPT end |
.feedback_which_ruby_version_is_in_use ⇒ Object
#
Roebe::CustomMethods.feedback_which_ruby_version_is_in_use
Feedback which ruby-version is in use:
#
126 127 128 129 130 131 132 133 |
# File 'lib/roebe/custom_methods/module.rb', line 126 def self.feedback_which_ruby_version_is_in_use e "#{rev}"+ "#{::Colours.mediumpurple('Ruby Version in use: ')}"+ "\e[1;32m"+ RUBY_VERSION.to_s+"\e[0;37m "+ "#{::Colours.lightblue('Welcome to Ruby!')} "\ "#{::Colours.palegreen('☺')}" end |
.ocra_build(on_this_file = 'examples/control_gallery.rb', name_of_the_output_exe = 'control_gallery.exe') ⇒ Object
#
Roebe::CustomMethods.ocra_build (ocra tag, orca tag)
This is ad-hoc code for windows.
Invocation example:
rinvoke Roebe.ocra_build
#
4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 |
# File 'lib/roebe/custom_methods/module.rb', line 4992 def self.ocra_build( on_this_file = 'examples/control_gallery.rb', name_of_the_output_exe = 'control_gallery.exe' ) if on_this_file.is_a? Array on_this_file = on_this_file.first end case on_this_file # ======================================================================= # # === :default # ======================================================================= # when :default, nil on_this_file = 'examples/control_gallery.rb' end case name_of_the_output_exe # ======================================================================= # # === :default # ======================================================================= # when :default name_of_the_output_exe = 'control_gallery.exe' end if name_of_the_output_exe.frozen? name_of_the_output_exe = name_of_the_output_exe.dup end unless name_of_the_output_exe.end_with? '.exe' name_of_the_output_exe << '.exe' end ::Roebe.esystem 'ocra '+on_this_file+' '\ '--dll ruby_builtin_dlls/libssp-0.dll '\ '--dll ruby_builtin_dlls/libgmp-10.dll '\ '--dll ruby_builtin_dlls/libffi-7.dll '\ '--gem-all=fiddle '\ '--output '+name_of_the_output_exe end |
.require_my_custom_addons ⇒ Object
#
Roebe::CustomMethods.require_my_custom_addons (require tag, requires tag)
This will load all gems and files that I consider useful, whenever I work with irb. Keep in mind that this can slow down IRB immensely, so only load these components up when it is necessary.
#
3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 |
# File 'lib/roebe/custom_methods/module.rb', line 3375 def self.require_my_custom_addons # ======================================================================= # # === array_require_these_files # ======================================================================= # array_require_these_files = %w( roebe/core/string.rb roebe/classes/passwords.rb roebe/classes/enable_autologin.rb optparse open-uri csv net/ftp find json open esystem opn beautiful_url colours directory_paradise save_file ascii_paradise dictionaries percentage environment_information rbt rcfiles beautiful_url bioroebe cyberweb mountpoints multimedia_paradise ) # studium e Thread.new { array_require_these_files.each_with_index {|file, index| index += 1 # Do failsafe requires. begin # e rev+index.to_s.rjust(4)+') Next requiring '+Colours.steelblue(file) require file case file when 'multimedia_paradise' # e 'Also setting M to an alias of MultimediaParadise.' # M = MultimediaParadise # ^^^ Hmm. end rescue LoadError => error e '=' * 80 e error if file == 'openssl' e 'We will feedback the error that we have received when loading '+ ::Colours.sfancy(error) e ::Colours.simp(error) e '=' * 80 case ENV['IS_ROEBE'].to_s when '1' puts '(from custom_methods.rb): The project `'+file+'` is not available.' end end } } e end |
.rev ⇒ Object
#
Roebe::CustomMethods.rev
#
117 118 119 |
# File 'lib/roebe/custom_methods/module.rb', line 117 def self.rev ::Colours.rev end |
.ruby_feature(id = ARGV.first) ⇒ Object
#
ruby_feature
#
721 722 723 724 725 |
# File 'lib/roebe/custom_methods/module.rb', line 721 def ruby_feature(id = ARGV.first) _ = 'https://bugs.ruby-lang.org/issues/'+id.to_s e 'Now opening '+sfancy(_) Open.in_browser(_) end |
.show_the_irb_history ⇒ Object
#
Roebe::CustomMethods.show_the_irb_history
Show the history of IRB so far.
#
3642 3643 3644 3645 3646 3647 |
# File 'lib/roebe/custom_methods/module.rb', line 3642 def self.show_the_irb_history if Object.const_defined? :Readline history_array = Readline::HISTORY.to_a print history_array.join("\n") end end |
Instance Method Details
#aa?(optional_sequence = nil) ⇒ Boolean
#
aa?
My trainer for amino acids. (aminosäuren) rinvoke aa?
#
4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 |
# File 'lib/roebe/custom_methods/module.rb', line 4766 def aa?(optional_sequence = nil) optional_sequence = ARGV.first.dup if ARGV.first puts; puts '-' * 80 x = Bioroebe.new(optional_sequence) if optional_sequence.nil? x.cra(20, 5) unless optional_sequence else # else user passed in a sequence x.translate end x.aa? e '-' * 80 puts;puts;puts e x.translate end |
#abb ⇒ Object
#
abb
#
2085 2086 2087 |
# File 'lib/roebe/custom_methods/module.rb', line 2085 def abb require 'abbrev' end |
#abc(inp = 1) ⇒ Object
#
abc
#
1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 |
# File 'lib/roebe/custom_methods/module.rb', line 1147 def abc(inp = 1) { :a => 1, :b => 2, :c => 3, :d => 4, :e => 5, :f => 6, :g => 7, :h => 8, :i => 9, :j => 10, :k => 11, :l => 12, :m => 13, :n => 14, :o => 15, :p => 16, :q => 17, :r => 18, :s => 19, :t => 20, :u => 21, :v => 22, :w => 23, :x => 24, :y => 25, :z => 26 } alp2 = %w{ a b c d e f g h i j k l m n o p q r s t u v w x y z } alp2.insert(0,nil) e e alp2[inp] end |
#add_ascii_suffix ⇒ Object
#
add_ascii_suffix
#
1620 1621 1622 1623 1624 1625 1626 |
# File 'lib/roebe/custom_methods/module.rb', line 1620 def add_ascii_suffix Dir['*'].each {|file| new_filename = file+'.ascii' e 'Now modifying '+file+' to '+new_filename+'.' mv(file, new_filename) } end |
#add_comment(i = 76) ⇒ Object
#
add_comment
#
3694 3695 3696 |
# File 'lib/roebe/custom_methods/module.rb', line 3694 def add_comment(i = 76) Roebe.add_comment(i) end |
#add_current_symlink_to_every_entry_under_programs ⇒ Object
#
add_current_symlink_to_every_entry_under_programs
rinvoke add_current_symlink_to_every_entry_under_programs
#
2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 |
# File 'lib/roebe/custom_methods/module.rb', line 2044 def add_current_symlink_to_every_entry_under_programs all_dirs = Dir['/Programs/*'] all_dirs.each {|entry| e entry cd entry File.delete('Current') if File.symlink? 'Current' numbered_dir = Dir['*'].select {|inner_entry| File.directory?(inner_entry) }.first e 'Now working on '+numbered_dir+'.' to_current(numbered_dir) } end |
#add_magnet_links ⇒ Object
#
add_magnet_links
Enable magnet links in transmission.
#
1853 1854 1855 1856 1857 1858 1859 1860 |
# File 'lib/roebe/custom_methods/module.rb', line 1853 def add_magnet_links _ = 'gconftool-2 -t string -s /desktop/gnome/url-handlers/magnet/command "transmission %s"' esystem _ _ = 'gconftool-2 -s /desktop/gnome/url-handlers/magnet/needs_terminal false -t bool' esystem _ _ = 'gconftool-2 -t bool -s /desktop/gnome/url-handlers/magnet/enabled true' esystem _ end |
#add_to_playlist(i = ARGV) ⇒ Object
#
add_to_playlist
#
3024 3025 3026 3027 |
# File 'lib/roebe/custom_methods/module.rb', line 3024 def add_to_playlist(i = ARGV) require 'multimedia_paradise' MultimediaParadise::Playlist.add_this_song(i) end |
#all_dirs(i = '*') ⇒ Object
#
all_dirs
Get all directories of the input-argument.
#
3834 3835 3836 |
# File 'lib/roebe/custom_methods/module.rb', line 3834 def all_dirs(i = '*') Dir[i].find_all { |f| ! File.directory?(f) } end |
#all_files(padding = ' ') ⇒ Object
#
all_files
#
4319 4320 4321 |
# File 'lib/roebe/custom_methods/module.rb', line 4319 def all_files(padding = ' ') Dir['*'].select {|file| File.file? entry }.each { |file| puts padding+file } end |
#alphabet_to_number(your_string) ⇒ Object
#
alphabet_to_number
alfabet tag alphabet tag alfa tag alpha tag (alfabet code) pass a string. This string will be converted to alphabet.
This way you can find out the total sum of all used alphabet chars.
Usage Examples:
atn("abc") # ==> 6
atn("jkj---k") # ==> 43
atn("lightppd") # ==> 92
atn("Crossbone".downcase) # ==> 110
atn("apache")
atn("pandora") # ==> 69
alphabet_to_number("apache")
#
2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 |
# File 'lib/roebe/custom_methods/module.rb', line 2555 def alphabet_to_number(your_string) # The following way is what apeiros showed me. # your_string.chars.inject(1000) { |s,char| s+char.first } sum = 0 your_string.each_char { |tmp| # zb a alphabet_char_position = 0 if ALPHABET.include? tmp alphabet_char_position = ALPHABET.index(tmp) + 1 # Only if the tmp char is in the alphabet, we add it up # puts "char war #{tmp}, sein value is #{alphabet_char_position}" sum += alphabet_char_position end # e "sum is nun #{sum}" } return sum end |
#append_help(i = 'normalize') ⇒ Object
#
append_help
#
4027 4028 4029 4030 4031 |
# File 'lib/roebe/custom_methods/module.rb', line 4027 def append_help( i = 'normalize' ) esystem "#{i} --help" end |
#ascii ⇒ Object
#
ascii
#
639 640 641 |
# File 'lib/roebe/custom_methods/module.rb', line 639 def ascii require 'ascii_paradise' end |
#ascii_alphabet ⇒ Object
#
ascii_alphabet
Following method displays each ascii value of a string.
#
221 222 223 224 225 |
# File 'lib/roebe/custom_methods/module.rb', line 221 def ascii_alphabet ALPHABET.chars.each { |char| e char.first # returns ascii value, such as ?a } end |
#ask_a_question_based_on_this_pwdstud_entry(this_position = 1) ⇒ Object
#
ask_a_question_based_on_this_pwdstud_entry
The argument to this method should be the number to the pwdstud entry such as 1 for pwdstud1, or 2 for pwdstud2 etc..
#
2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 |
# File 'lib/roebe/custom_methods/module.rb', line 2827 def ask_a_question_based_on_this_pwdstud_entry( this_position = 1 ) require 'studium' this_position -= 1 # We start to count at 1, hence we must subtract 1 to deal with ruby Arrays. regex = Studium.regex_for_pwd_stud # Obtain the regex for Studium here. file = Studium.file_cd_aliases _ = File.read(file) exam_type = File.basename( _.scan(regex).sort[this_position] ).gsub(/; pwd/,'').strip # ======================================================================= # # Next get rid of numbered-input. # ======================================================================= # if exam_type =~ /^\d+-?\d*(.+)/ exam_type = $1.to_s.dup.downcase.delete('_') end Studium.ask_exam_question(exam_type) # Delegate to class AskExamQuestion next. end |
#autoinclude ⇒ Object
#
autoinclude
This is mostly an add-hoc method that I use to include this module on IRB on windows.
#
791 792 793 |
# File 'lib/roebe/custom_methods/module.rb', line 791 def autoinclude include Roebe::CustomMethods end |
#autostart ⇒ Object Also known as: kde_autostart
#
autostart
Enable autostarting some apps for KDE. rinvoke autostart
#
5101 5102 5103 5104 |
# File 'lib/roebe/custom_methods/module.rb', line 5101 def autostart require 'autostart' Autostart.new(:kde) # bl $RUBY_TOOLS/autostart.rb end |
#avg(i = ARGV, display_result = true) ⇒ Object Also known as: average, mean
#
avg
This method will returns the average of numbers.
If a String is encountered then this method will convert that String into a Float.
Example:
avg [5, 6, 7, 8]
avg 5,10,15,30 # => 15.0
avg [5,10,15,30] # => 15.0
average '2556 + 5320 + 3595 + 2806'
avg '5.42 5.53 5.49'
avg %w( 1 2 3 4 5 6 7 )
x = [12, 3, 15, 18, 22, 9, 5, 8, 16, 21]
#
2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 |
# File 'lib/roebe/custom_methods/module.rb', line 2326 def avg( i = ARGV, display_result = true ) if i.is_a? Array i.map! {|entry| entry.to_f } end sum = i.sum.to_f average = sum / i.size return average end |
#avinfo(file = '') ⇒ Object
#
avinfo
multimedia stuff, avinfo
#
407 408 409 410 411 |
# File 'lib/roebe/custom_methods/module.rb', line 407 def avinfo(file = '') e ' === AVINFORMATION === ' e system("avinfo #{file}") e ' === END === ' end |
#backup_kde ⇒ Object
#
backup_kde
rinvoke backup_kde
#
4684 4685 4686 4687 4688 4689 4690 4691 |
# File 'lib/roebe/custom_methods/module.rb', line 4684 def backup_kde kde_base_dir = '/root/.kde/share/apps/' e 'We will now backup some KDE settings.' copy_file kde_base_dir+'konqueror/konqueror.rc', '/home/x/data/PC/OS/LINUX/KDE/' copy_file kde_base_dir+'konsole/konsoleui.rc', '/home/x/DATA/PC/OS/LINUX/KDE/' end |
#bash ⇒ Object
#
bash
#
1140 1141 1142 |
# File 'lib/roebe/custom_methods/module.rb', line 1140 def bash system("bash -c '. ~/.bashrc;ll'") end |
#batch_create_files ⇒ Object
#
batch_create_files
This simply creates several files in one go.
rin batch_create_files
#
4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 |
# File 'lib/roebe/custom_methods/module.rb', line 4112 def batch_create_files startname = 'wall' range = (11..35).to_a append_this = '.c' range.each { |x| filename = startname+x.to_s+append_this puts filename create_file(filename) } end |
#benchmark_prototype ⇒ Object
#
benchmark_prototype
Show what code we can use for a benchmark prototype.
#
4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 |
# File 'lib/roebe/custom_methods/module.rb', line 4525 def benchmark_prototype lpad = '' # This can be set to e. g. ' ' to allow initial padding. e lpad+"require 'benchmark'" e lpad+'N_TIMES = 250_000' e e lpad+'Benchmark.bm { |x|' e lpad+" x.report('Testing: Dir.entries(Dir.pwd)') {" e lpad+' N_TIMES.times { Dir.entries(Dir.pwd) }' e lpad+' }' e lpad+" x.report(\"Testing: Dir['*'] \") {" e lpad+" N_TIMES.times { Dir['*'] }" e lpad+' }' e lpad+'}' end |
#binary(i) ⇒ Object
#
binary
This is binary upload of ftp_upload.
#
4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 |
# File 'lib/roebe/custom_methods/module.rb', line 4175 def binary(i) require 'ftp_paradise' if i.is_a? Array i.each {|entry| binary(entry) } else _ = FtpParadise::Connection.new('SHEVY', :dont_run_yet) _.be_verbose _.set_mode :binary, :be_verbose _.set_data('SHEVY') _.do_login('SHEVY') _.upload(file) if File.exist? file end end |
#bit? ⇒ Boolean
#
bit?
#
4554 4555 4556 4557 |
# File 'lib/roebe/custom_methods/module.rb', line 4554 def bit? cmd = 'grep -q "^flags.*\blm\b" /proc/cpuinfo && echo "x86_64" || echo "not x86_64"' system cmd end |
#boku? ⇒ Boolean
#
boku?
#
3996 3997 3998 3999 4000 |
# File 'lib/roebe/custom_methods/module.rb', line 3996 def boku? e BeautifulUrl[:boku] e BeautifulUrl[:bokumail] Passwords.password_for :boku end |
#border? ⇒ Boolean
#
border?
Feedback the available CSS Borders.
#
672 673 674 |
# File 'lib/roebe/custom_methods/module.rb', line 672 def border? e 'dotted dashed solid double groove ridge inset outset' end |
#build_all_my_local_gems ⇒ Object
#
build_all_my_local_gems
#
1583 1584 1585 |
# File 'lib/roebe/custom_methods/module.rb', line 1583 def build_all_my_local_gems ::Roebe.build_all_my_local_gems end |
#bundle_exam_results ⇒ Object Also known as: bundle_exams
#
bundle_exam_results
See the module-method for the documentation to this method here.
#
1633 1634 1635 |
# File 'lib/roebe/custom_methods/module.rb', line 1633 def bundle_exam_results ::Roebe.bundle_exam_results end |
#calculate_sum_for_excel(start_number = 4, up_to = 128, array = %w( I J K )) ⇒ Object
#
calculate_sum_for_excel
#
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 |
# File 'lib/roebe/custom_methods/module.rb', line 570 def calculate_sum_for_excel( start_number = 4, # We start at this number here. up_to = 128, # And we end at this number here. array = %w( I J K ) # Which rows to use will be designated in this array. ) # excel e array.each {|index_character| print '=SUM(' # For now, we only use =SUM in excel. start_number.step(up_to,2) {|i| print index_character+i.to_s+';' } print ')' e; e } e end |
#cat(i = ARGV) ⇒ Object
#
cat
#
1647 1648 1649 |
# File 'lib/roebe/custom_methods/module.rb', line 1647 def cat(i = ARGV) ::Roebe.cat(i) end |
#ccc ⇒ Object
#
ccc
#
4863 4864 4865 |
# File 'lib/roebe/custom_methods/module.rb', line 4863 def ccc esystem 'clear' end |
#chance(base_chance = 25) ⇒ Object
#
chance
Base chance is measured towards 100. A value of 25 as input argument means that in every 1/4 calls, true is returned.
Commandline invocation:
rinvoke chance
#
339 340 341 342 343 344 345 |
# File 'lib/roebe/custom_methods/module.rb', line 339 def chance( base_chance = 25 ) # The input variable is tested against the following variable. this_turn_chance = rand(100)+1 # From 1 to 100. e this_turn_chance <= base_chance ? true : false end |
#change_all_entries_for_today ⇒ Object
#
change_all_entries_for_today
#
4516 4517 4518 |
# File 'lib/roebe/custom_methods/module.rb', line 4516 def change_all_entries_for_today Dir['*'].each {|file| FileUtils.touch(file) } end |
#chdir(i = '/Depot/Temp') ⇒ Object Also known as: cd
#
chdir (chdir tag)
This method must be able to work with $VARIABLES, because on windows the typical ENV may not be available as-is.
#
652 653 654 655 656 657 658 659 660 661 662 663 664 665 |
# File 'lib/roebe/custom_methods/module.rb', line 652 def chdir( i = '/Depot/Temp' ) i = i.dup if i.frozen? i.strip! if i.include? '$' i = ConvertGlobalEnv[i] end if File.directory? i Dir.chdir(i) else e "#{i} is not a directory." end end |
#chmod?(i = ARGV, output_result = true) ⇒ Boolean
#
chmod?
#
1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 |
# File 'lib/roebe/custom_methods/module.rb', line 1201 def chmod?( i = ARGV, output_result = true ) if i.is_a? Array i.each {|entry| chmod?(entry, output_result) } else = File.stat(i).mode.to_s(8)[-3,3].to_s if output_result puts else return end end end |
#chunker(f_in, out_pref, chunksize = (1_073_741_824 / 1024.0)) ⇒ Object
#
chunker
Splits at 1 MB by default.
#
4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 |
# File 'lib/roebe/custom_methods/module.rb', line 4374 def chunker( f_in, out_pref, chunksize = (1_073_741_824 / 1024.0) ) out_pref = f_in.dup if out_pref.nil? File.open(f_in,'r') { |fh_in| _ = "#{out_pref}_#{"%05d"%(( fh_in.pos / chunksize )+1)}.txt" File.open(_,'w') { |fh_out| fh_out << fh_in.read(chunksize) } until fh_in.eof? } end |
#close ⇒ Object Also known as: clo
#
close
#
1133 1134 1135 |
# File 'lib/roebe/custom_methods/module.rb', line 1133 def close system('close') end |
#clr ⇒ Object Also known as: clear
#
clr
Clear your system
#
3867 3868 3869 |
# File 'lib/roebe/custom_methods/module.rb', line 3867 def clr system('clear') end |
#colour_to_hex(i = ARGV) ⇒ Object
#
colour_to_hex
#
4487 4488 4489 4490 4491 |
# File 'lib/roebe/custom_methods/module.rb', line 4487 def colour_to_hex(i = ARGV) require 'colours/rgb_to_hex/rgb_to_hex.rb' i = i.first if i.is_a? Array e Colours::RgbToHex[i.to_s] end |
#colourized_method(input = '', colour = 'green', make_newline = true, print_result = true) ⇒ Object Also known as: cme, cm
#
colourized_method (cme tag colme tag)
This method prints colourized strings. Note that you do not have to use “print” with this method - default is to print to STDOUT.
-
If string_logging is true, we will return a string, which is stored
in the global variable $LOGGING.
x = cme "test", 'def', true, false
#
2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 |
# File 'lib/roebe/custom_methods/module.rb', line 2603 def colourized_method( input = '', colour = 'green', make_newline = true, print_result = true ) result = ''.dup # our result string colour = 'green' if colour.to_s.downcase == 'def' result << pick_color(colour) unless colour.nil? result << input.to_s # result << Colour.clear unless colour.nil? result << "\n" if make_newline if print_result print result else return result end end |
#compile(this_program = 'php5') ⇒ Object Also known as: comp, ry
#
compile
Compile the given program.
#
4238 4239 4240 |
# File 'lib/roebe/custom_methods/module.rb', line 4238 def compile(this_program = 'php5') RBT::Installer.new(this_program) end |
#compile_as_appdir(i = return_pwd) ⇒ Object Also known as: compile_into_appdir
#
compile_as_appdir (appconf, appdir)
This method allows you to quickly compile into an Appdir-Like structure.
#
5259 5260 5261 |
# File 'lib/roebe/custom_methods/module.rb', line 5259 def compile_as_appdir(i = return_pwd) self.compile_as_appdir(i) end |
#compile_into_xfce_prefix ⇒ Object
#
compile_into_xfce_prefix
Use this method if you want to compile into a special XFCE Prefix.
#
1481 1482 1483 1484 |
# File 'lib/roebe/custom_methods/module.rb', line 1481 def compile_into_xfce_prefix _ = './configure --prefix='+ENV['XFCE_PREFIX'] esystem _ end |
#compile_these(these = ARGV) ⇒ Object
#
compile_these
compile_these imlib2loaders libnet cups
#
5229 5230 5231 5232 5233 |
# File 'lib/roebe/custom_methods/module.rb', line 5229 def compile_these(these = ARGV) _ = '"'+ARGV.join(',')+'"' require 'bt' # bl $BT/chained_compiling* _ = ChainedCompiling.new(_, nil, :compile) end |
#completion(dataset = nil) ⇒ Object
#
completion
Generate the english-completion.
rinvoke completion
#
5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 |
# File 'lib/roebe/custom_methods/module.rb', line 5552 def completion( dataset = nil ) require 'dictionaries' require 'generate_shell_completion' if dataset.nil? require 'yaml' dataset = YAML.load_file(Dictionaries.file_english).keys generate_where = '/home/x/DATA/PC/OS/LINUX/SHELL/SCRIPTS/english_completion.sh' end _ = GenerateShellCompletion.new(false) _.add_data(dataset) _.set_file(generate_where) _.set_name_of_function('english') _.add_alias 'askeng' _.generate e "Stored into `#{generate_where}`." generate_rf_completions end |
#configure_magic ⇒ Object Also known as: configuremagic
#
configure_magic
#
2803 2804 2805 2806 2807 2808 2809 |
# File 'lib/roebe/custom_methods/module.rb', line 2803 def configure_magic _ = './configure --prefix=/Programs/Xfce/4.12' e _ system _ system 'make' system 'make install' end |
#copy_cookbook_files_into_ruby_cookbooks_directory ⇒ Object
#
copy_cookbook_files_into_ruby_cookbooks_directory
This method will always work anyway, without requiring to cd to the target directory.
#
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
# File 'lib/roebe/custom_methods/module.rb', line 426 def copy_cookbook_files_into_ruby_cookbooks_directory target_dir = RUBY_SRC_DIR+'rbt/lib/rbt/yaml/individual_cookbooks/' cd target_dir FileUtils.rm_rf(target_dir) FileUtils.mkdir(target_dir) Dir["#{target}*.yml"].each {|file| copy_file(file, target_dir) } # ======================================================================= # # Next, install the new cookbooks if we are on roebe: # ======================================================================= # if is_on_roebe? cd RUBY_SRC_DIR+'rbt/' r2 end end |
#copy_file(file, where_to = return_pwd) ⇒ Object Also known as: copy
#
copy_file (copy tag)
Copies a file.
#
1045 1046 1047 |
# File 'lib/roebe/custom_methods/module.rb', line 1045 def copy_file(file, where_to = return_pwd) self.copy_file(file, where_to) end |
#cpp_header? ⇒ Boolean
#
cpp_header?
#
5220 5221 5222 |
# File 'lib/roebe/custom_methods/module.rb', line 5220 def cpp_header? ::Roebe.cpp_header? end |
#cpruby ⇒ Object
#
cpruby
#
2639 2640 2641 |
# File 'lib/roebe/custom_methods/module.rb', line 2639 def cpruby ::Roebe.cpruby end |
#cpu? ⇒ Boolean Also known as: cpu
#
cpu?
Spits out CPU info. Taps into modules.
struct.members => array, Returns an array of strings
representing the names of the instance variables.
#
2671 2672 2673 |
# File 'lib/roebe/custom_methods/module.rb', line 2671 def cpu? SysInfo.get_system_info end |
#create_benchmark_file ⇒ Object
#
create_benchmark_file
#
3252 3253 3254 3255 |
# File 'lib/roebe/custom_methods/module.rb', line 3252 def create_benchmark_file require 'roebe/classes/create_benchmark_file.rb' Roebe::CreateBenchmarkFile.new end |
#create_database ⇒ Object
#
create_database
insert into programs values(“a”,“b”,“c”); rvoke create_database
#
4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 |
# File 'lib/roebe/custom_methods/module.rb', line 4352 def create_database require 'yaml' require 'rbt/constants/constants.rb' _ = RBT.file_registered_cookbook_entries sys_string = 'create table programs ('+N.dup sys_string << ' id integer primary key autoincrement,'+N entries = YAML.load_file(_) size = entries.size entries.each_with_index { |entry, index| sys_string << ' '+entry.to_s+' varchar(255)' sys_string << ',' unless index == (size-1) sys_string << N } sys_string << ')' e sys_string end |
#create_directories ⇒ Object
#
create_directories
#
4612 4613 4614 |
# File 'lib/roebe/custom_methods/module.rb', line 4612 def create_directories self.create_directories end |
#create_directory(i) ⇒ Object Also known as: mkdir
#
create_directory
This method can be used to create a directory, using Ruby.
#
4605 4606 4607 |
# File 'lib/roebe/custom_methods/module.rb', line 4605 def create_directory(i) FileUtils.mkdir(i) unless File.directory? i # Unless it already exists. end |
#create_file(i = '') ⇒ Object Also known as: touch
#
create_file
Create a file in the current directory. The first argument to this method is the filename.
#
4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 |
# File 'lib/roebe/custom_methods/module.rb', line 4873 def create_file(i = '') # <- Filename if i.is_a? Array i.each {|entry| create_file(entry) } else if File.exist? i e 'Can not create file '+i+' as it already exists.' else FileUtils.touch(i) end end end |
#create_image_collection ⇒ Object
#
create_image_collection
This method will find all images under $IMG and create a html file with all the links to it.
Commandline invocation:
rinvoke create_image_collection
#
1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 |
# File 'lib/roebe/custom_methods/module.rb', line 1398 def create_image_collection _ = Dir[ENV['IMG'].to_s+'/*/**'] _.reject! {|entry| File.directory?(entry) } _.reject! {|file| ! is_image_file?(file) } # next we will create a new html page my_file = '/Depot/IMAGES.html' create_file my_file append '<html><body><table>', my_file _.each { |image| append '<tr><td><b>'+image+'</b></td><td>'+'<img src="'+image+'"></td></tr>'+"\n",my_file } append '</table></body></html>', my_file e 'Look at '+my_file end |
#create_individual_file(array) ⇒ Object
#
create_individual_file
This throwaway method I use to create stubs.
#
2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 |
# File 'lib/roebe/custom_methods/module.rb', line 2927 def create_individual_file(array) array.each { |file| file = file.dup file << '.yml' if File.exist? file e 'Can not create `'+file+'` as this exists already.' else e 'Creating file `'+file+'` now.' create_file(file) end } end |
#create_lua_pc_file ⇒ Object
#
create_lua_pc_file
#
3072 3073 3074 |
# File 'lib/roebe/custom_methods/module.rb', line 3072 def create_lua_pc_file ::Roebe::CustomMethods.create_lua_pc_file end |
#create_njoy_page ⇒ Object
#
create_njoy_page
This will generate a page with images.
#
3013 3014 3015 3016 3017 3018 3019 |
# File 'lib/roebe/custom_methods/module.rb', line 3013 def create_njoy_page require 'diamond_shell/standalone_classes/webpage_for_images.rb' cd '/Depot/j' _ = WebpageForImages.new :do_not_run_yet _.use_this_dir = HOME_DIRECTORY_OF_USER_X+'DATA/IMG/NJOY/' _.run end |
#create_rpm_dirs ⇒ Object
#
create_rpm_dirs
#
316 317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/roebe/custom_methods/module.rb', line 316 def create_rpm_dirs # rinvoke create_rpm_dirs esystem 'mkdir -p ~/RPB_BUILDS/src/rpm/RPMS/noarch' esystem 'mkdir -p ~/RPB_BUILDS/src/rpm/RPMS/i586' esystem 'mkdir -p ~/RPB_BUILDS/src/rpm/RPMS/i686' esystem 'mkdir -p ~/RPB_BUILDS/src/rpm/RPMS/i486' esystem 'mkdir -p ~/RPB_BUILDS/src/rpm/RPMS/i386' esystem 'mkdir -p ~/RPB_BUILDS/src/rpm/RPMS/athlon' esystem 'mkdir -p ~/RPB_BUILDS/src/rpm/BUILD' esystem 'mkdir -p ~/RPB_BUILDS/src/rpm/SRPMS' esystem 'mkdir -p ~/RPB_BUILDS/src/rpm/SOURCES' esystem 'mkdir -p ~/RPB_BUILDS/src/rpm/SPECS' esystem 'mkdir -p ~/RPB_BUILDS/src/tmp' end |
#create_these_files_and_open_them(also_open_these_files = false) ⇒ Object
#
create_these_files_and_open_them
#
1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 |
# File 'lib/roebe/custom_methods/module.rb', line 1736 def create_these_files_and_open_them( also_open_these_files = false ) base_name = 'chopper_' file_ending = '.ascii' 1.upto(30).each {|number| number = number.to_s.rjust(2,'0') _ = base_name+number+file_ending e _ touch _ open_in_editor(_) if also_open_these_files } end |
#cropdetect(i = ARGV.first) ⇒ Object
#
cropdetect
If you want to view the video, change -vo from null to xv rinvoke cropdetect
#
4546 4547 4548 4549 |
# File 'lib/roebe/custom_methods/module.rb', line 4546 def cropdetect(i = ARGV.first) _ = "mplayer -ao null -vo null -vf cropdetect=24:2 #{i}" esystem _ end |
#css_comments? ⇒ Boolean Also known as: css_hints
#
css_comments?
How to do comments in .css files?
#
632 633 634 |
# File 'lib/roebe/custom_methods/module.rb', line 632 def css_comments? e '/* This is a CSS comment. */' end |
#csv(i = 'trees91.csv') ⇒ Object
#
csv
Simplified way to read in a .csv file.
#
2705 2706 2707 2708 2709 |
# File 'lib/roebe/custom_methods/module.rb', line 2705 def csv(i = 'trees91.csv') csv = CSV.read(i, headers: true) # your data" csv.each {|entry| p entry } return csv end |
#custom_parse_this_XML_file_and_extract_email_contact_information(i = '/Depot/j/CONTACTS/') ⇒ Object
#
custom_parse_this_XML_file_and_extract_email_contact_information
Invocation example:
big_array = custom_parse_this_XML_file_and_extract_email_contact_information; pp big_array;''
#
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 |
# File 'lib/roebe/custom_methods/module.rb', line 532 def custom_parse_this_XML_file_and_extract_email_contact_information( # i = 'ack.XML' i = '/Depot/j/CONTACTS/' ) if File.directory? i files = Dir[i+'*.contact'] return files.map {|entry| custom_parse_this_XML_file_and_extract_email_contact_information(entry) } else if File.exist?(i) original_file = i.dup i = ::Roebe.default_file_read(i).dup end name = i.scan( /<c:FormattedName>(.+)<\/c:FormattedName>/ ).flatten.first.dup begin email = i.scan( /<c:Address>(.+)<\/c:Address>/ ).flatten.first.dup rescue ArgumentError => error pp error e 'Error for the file: '+sfile(original_file) end if name and name.include?("'") name.delete!("'") end if email.nil? or !email.include?('@') e 'Wrong entry for '+tomato(name)+'.' end return [name, email] end end |
#custom_prompt ⇒ Object Also known as: my_prompt, myprompt
#
custom_prompt
#
3686 3687 3688 |
# File 'lib/roebe/custom_methods/module.rb', line 3686 def custom_prompt Roebe::CustomMethods.enable_roebe_prompt end |
#cyberweb ⇒ Object Also known as: cyber, web_object
#
cyberweb
#
3605 3606 3607 |
# File 'lib/roebe/custom_methods/module.rb', line 3605 def cyberweb require 'cyberweb' end |
#date ⇒ Object
#
date
Displays date.
#
2680 2681 2682 |
# File 'lib/roebe/custom_methods/module.rb', line 2680 def date system 'date' end |
#default ⇒ Object
#
default
#
3032 3033 3034 3035 3036 3037 3038 3039 3040 |
# File 'lib/roebe/custom_methods/module.rb', line 3032 def default 51.upto(150).each {|index| file_name = 'sailing_boat_'+index.to_s+'.ascii' FileUtils.touch(file_name) _ = "#{MAIN_EDITOR_TO_USE} #{file_name}" Esystem.esystem _ sleep 0.25 } end |
#delete_all_directories_from_this_directory ⇒ Object
#
delete_all_directories_from_this_directory
This will delete all directories from the current working directory.
Use with caution!
Commandline invocation:
rinvoke delete_all_directories_from_this_directory
#
1832 1833 1834 1835 1836 1837 |
# File 'lib/roebe/custom_methods/module.rb', line 1832 def delete_all_directories_from_this_directory all_dirs = Dir['*'].select {|entry| File.directory? entry }.reject {|entry| entry.strip.squeeze('/') == '/' # Don't want to delete the root directory. } remove_directory(all_dirs) end |
#delete_all_empty_directories_from_this_directory ⇒ Object
#
delete_all_empty_directories_from_this_directory
This will delete all directories from this directory.
#
713 714 715 716 |
# File 'lib/roebe/custom_methods/module.rb', line 713 def delete_all_empty_directories_from_this_directory all_dirs = Dir['*'].select {|entry| File.directory? entry } remove_directory(all_dirs, :only_delete_if_it_is_empty) end |
#delete_file(i) ⇒ Object Also known as: remove_file, del
#
delete_file
#
991 992 993 |
# File 'lib/roebe/custom_methods/module.rb', line 991 def delete_file(i) File.delete(i) if File.exist? i end |
#dia ⇒ Object
#
dia
#
952 953 954 |
# File 'lib/roebe/custom_methods/module.rb', line 952 def dia require 'diamond_shell' end |
#dir(which_files = 'tar.bz2') ⇒ Object Also known as: glob
#
dir
With this method you can get a listing of all files, ie all pov files. Try it:
x = dir 'pov'
#
2631 2632 2633 2634 |
# File 'lib/roebe/custom_methods/module.rb', line 2631 def dir(which_files = 'tar.bz2') e 'Error! must supply default file type.' if which_files.nil? Dir["*.#{which_files}"].each { |x| printf("%s\n", x) } end |
#dirs? ⇒ Boolean
#
dirs?
Yield back all directories from the current directory.
#
1491 1492 1493 |
# File 'lib/roebe/custom_methods/module.rb', line 1491 def dirs? Dir['*'].select {|entry| File.directory? entry } end |
#disable_input ⇒ Object
#
disable_input
This disables input.
#
391 392 393 |
# File 'lib/roebe/custom_methods/module.rb', line 391 def disable_input system 'stty -echo -icanon' end |
#display_battery ⇒ Object
#
display_battery
#
3754 3755 3756 3757 |
# File 'lib/roebe/custom_methods/module.rb', line 3754 def display_battery require 'x/tools/battery.rb' Battery.new end |
#display_help_for_wurzel_ziehen ⇒ Object
#
display_help_for_wurzel_ziehen
#
3889 3890 3891 3892 3893 3894 |
# File 'lib/roebe/custom_methods/module.rb', line 3889 def display_help_for_wurzel_ziehen e 'Die dritte Wurzel ziehen geht so:' efancy ' Math.sqrt3 WERT' e 'Normale Wurzel ziehen geht so:' efancy ' Math.sqrt WERT' end |
#divide(*args) ⇒ Object
#
divide
Takes one or more objects (which should respond to the ‘/’ method) and returns the result of applying the ‘/’ method successively to each object
#
1930 1931 1932 1933 1934 1935 1936 1937 |
# File 'lib/roebe/custom_methods/module.rb', line 1930 def divide(*args) args = *args divide = args.shift args.each { |elem| divide = divide/elem } divide end |
#do_pid(create_this_directory = '/Depot/dir_created_as_some_user/') ⇒ Object
#
do_pid
Used to replace stuff.
#
267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/roebe/custom_methods/module.rb', line 267 def do_pid( create_this_directory = '/Depot/dir_created_as_some_user/' ) user_id = 99 Dir.mkdir '/Depot/dir_created_as_root' Process.as_uid(user_id) { e 'Creating the directory '+create_this_directory+' next.' Dir.mkdir create_this_directory %x{ whoami } } end |
#dolphin ⇒ Object
#
dolphin
Play the Simpson halloween that refers to dolphin.
#
5435 5436 5437 5438 5439 |
# File 'lib/roebe/custom_methods/module.rb', line 5435 def dolphin require 'multimedia_paradise' _ = '/Depot/Video/Cartoons/Simpsons-12/Simpsons_12x01_Tree_House_of_Horror_XI.avi' system "mpv -vo x11 #{_}" end |
#dosbox_config(i = ARGV) ⇒ Object
#
dosbox_config
rinvoke dosbox_config
#
4166 4167 4168 |
# File 'lib/roebe/custom_methods/module.rb', line 4166 def dosbox_config(i = ARGV) self.dosbox_config(i) end |
#download(this_url = ARGV.first) ⇒ Object
3001 3002 3003 3004 3005 3006 |
# File 'lib/roebe/custom_methods/module.rb', line 3001 def download(this_url = ARGV.first) require 'cyberweb' _ = Cyberweb.download_webpage(this_url) e _.string e "\nThe target was "+_.url end |
#download_favicon(this_url = 'https://www.ruppweb.org/Xray/101index.html') ⇒ Object
#
download_favicon
Use this method if you wish to download a favicon.
#
5033 5034 5035 5036 5037 5038 |
# File 'lib/roebe/custom_methods/module.rb', line 5033 def download_favicon( this_url = 'https://www.ruppweb.org/Xray/101index.html' ) require 'cyberweb' Cyberweb.download_favicon(this_url) end |
#download_llvm_stuff ⇒ Object
#
download_llvm_stuff
#
3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 |
# File 'lib/roebe/custom_methods/module.rb', line 3286 def download_llvm_stuff cd '/home/x/Temp/' mkdir 'llvm_stuff' cd 'llvm_stuff' require 'wget' e "We are in the directory #{sdir(return_pwd)}." # ======================================================================= # # === llvm next: # ======================================================================= # url1 = 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/llvm-15.0.7.src.tar.xz' unless File.exist? File.basename(url1) Wget.new(url1) { :no_check_certificate } end # ======================================================================= # # === llvm-cmake next: # ======================================================================= # url2 = 'https://anduin.linuxfromscratch.org/BLFS/llvm/llvm-cmake-15.0.7.src.tar.xz' unless File.exist? File.basename(url2) Wget.new(url2) { :no_check_certificate } end # ======================================================================= # # === clang next: # ======================================================================= # url3 = 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang-15.0.7.src.tar.xz' unless File.exist? File.basename(url3) Wget.new(url3) { :no_check_certificate } end # ======================================================================= # # === clang-ssp1 patch next: # ======================================================================= # url4 = 'https://www.linuxfromscratch.org/patches/blfs/svn/clang-15.0.7-enable_default_ssp-1.patch' unless File.exist? File.basename(url4) Wget.new(url4) { :no_check_certificate } end # ======================================================================= # # === compiler-rt next: # ======================================================================= # url5 = 'https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/compiler-rt-15.0.7.src.tar.xz' unless File.exist? File.basename(url5) Wget.new(url5) { :no_check_certificate } end e 'You should cd into '+sdir(return_pwd)+' next.' end |
#druby(i = '9000') ⇒ Object
#
druby
rinvoke druby
#
2223 2224 2225 2226 2227 2228 |
# File 'lib/roebe/custom_methods/module.rb', line 2223 def druby(i = '9000') DRb.start_service where = 'druby://localhost:'+i.to_s obj = DRbObject.new(nil, where) e "Sum is: #{obj.add(1,2,3)}" end |
#dump_all_my_gems ⇒ Object
#
dump_all_my_gems
This method will build all my gems and then copy them into a new location.
#
4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 |
# File 'lib/roebe/custom_methods/module.rb', line 4461 def dump_all_my_gems require 'fileutils' require 'roebe/constants/array_install_these_gem_projects.rb' target_base_dir = '/Depot/Temp/my_gems/' remove_directory(target_base_dir) if File.directory? target_base_dir mkdir(target_base_dir) base_dir = RUBY_SRC_DIR Roebe.array_install_these_gem_projects.each {|this_gem| e base_dir+this_gem cd base_dir+this_gem make_gem this_gem = Dir['*.gem'] unless this_gem.empty? this_gem = this_gem.first e 'Now moving `'+sfancy(this_gem)+'` to `'+sdir(target_base_dir)+'`.' FileUtils.mv( this_gem, target_base_dir ) end } cliner { e 'Finished putting all into '+sdir(target_base_dir)+'!' } end |
#e(i = '') ⇒ Object
#
e
#
90 91 92 |
# File 'lib/roebe/custom_methods/module.rb', line 90 def e(i = '') puts i end |
#eject ⇒ Object Also known as: eje
#
eject
#
1126 1127 1128 |
# File 'lib/roebe/custom_methods/module.rb', line 1126 def eject system('eject') end |
#enable_auto_login ⇒ Object
#
enable_auto_login
This method enables autologin.
rinvoke enable_auto_login
#
1333 1334 1335 |
# File 'lib/roebe/custom_methods/module.rb', line 1333 def enable_auto_login EnableAutologin.new end |
#enable_autoindent ⇒ Object
#
enable_autoindent
Enable autoindent in IRB.
#
4628 4629 4630 |
# File 'lib/roebe/custom_methods/module.rb', line 4628 def enable_autoindent IRB.conf[:AUTO_INDENT] = true end |
#enable_input ⇒ Object
#
enable_input
#
398 399 400 |
# File 'lib/roebe/custom_methods/module.rb', line 398 def enable_input system 'stty echo icanon' end |
#enable_my_firefox_profile ⇒ Object
#
enable_my_firefox_profile
rinvoke enable_my_firefox_profile
#
4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 |
# File 'lib/roebe/custom_methods/module.rb', line 4698 def enable_my_firefox_profile _ = ENV['FF'].to_s+'/' __ = ENV['MY_FF_DIR'] # pwdlinyam; bl roeber* __ = '/home/debug/.mozilla/firefox/w2rv0q83.default/' puts 'Enabling my firefox profile next to '+__ # cd $MY_FF_DIR FileUtils.cp _+'userChrome.css', __+'/chrome/' FileUtils.cp _+'hperm', __+'/hostperm.1' FileUtils.cp _+'user.js', __+'/' FileUtils.cp _+'userContent.css', __+'/chrome/' FileUtils.cp _+'barmid.png', __+'/chrome/' FileUtils.cp _+'bar.png', __+'/chrome/' # Next, enable java target = '/root/.mozilla/plugins/libjavaplugin_oji.so' target = '/home/debug/.mozilla/plugins/libjavaplugin_oji.so' system 'ln -s /Programs/Java/1.5.0/plugin/i386/ns7-gcc29/libjavaplugin_oji.so '+target end |
#enable_nano_config ⇒ Object Also known as: generate_nano_config
#
enable_nano_config
rinvoke enable_nano_config
#
5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 |
# File 'lib/roebe/custom_methods/module.rb', line 5111 def enable_nano_config require 'save_file' require 'convert_global_env' target_file = ConvertGlobalEnv['$HOME']+'/.nanorc' opn; e 'Appending info to '+sfile(target_file) File.delete(target_file) if File.exist? target_file nano_dir = '/home/x/data/PC/EDITORS/NANO/' files_to_copy = Dir["#{nano_dir}*.txt"] files_to_copy.each {|file| content = File.read(file) ::Roebe.append_what_into(content, target_file) } opn; e "Finished storing into #{sfile(target_file)}." end |
#encodings? ⇒ Boolean
#
encodings?
Simply list all available encodings.
#
832 833 834 |
# File 'lib/roebe/custom_methods/module.rb', line 832 def encodings? return Encoding.list end |
#env ⇒ Object
#
env
read in environmental sections into the global var $env
#
4157 4158 4159 |
# File 'lib/roebe/custom_methods/module.rb', line 4157 def env $env = `env`.split("\n").to_a.sort end |
#esystem(i) ⇒ Object
#
esystem
#
761 762 763 764 |
# File 'lib/roebe/custom_methods/module.rb', line 761 def esystem(i) e i system i end |
#extract(i) ⇒ Object Also known as: ext
#
extract
Usage example:
extract 'Packages-List-Printing.squashfs'
#
3815 3816 3817 3818 |
# File 'lib/roebe/custom_methods/module.rb', line 3815 def extract(i) require 'extracter' Extracter[i] end |
#extract_url(url_string = ARGV.first) ⇒ Object
2172 2173 2174 2175 |
# File 'lib/roebe/custom_methods/module.rb', line 2172 def extract_url(url_string = ARGV.first) require 'uri' e URI::extract(url_string) end |
#extract_what_to(what, to = return_pwd) ⇒ Object
#
extract_what_to
Use this to extract something.
#
2587 2588 2589 2590 |
# File 'lib/roebe/custom_methods/module.rb', line 2587 def extract_what_to(what, to = return_pwd) require 'extracter' Extracter.extract_what_to(what, to) end |
#fancy_irb ⇒ Object Also known as: fancyirb, firb
#
fancy_irb
#
3440 3441 3442 3443 3444 3445 3446 |
# File 'lib/roebe/custom_methods/module.rb', line 3440 def fancy_irb require 'fancy_irb' FancyIrb.start # FancyIrb.start( # {rocket_prompt: "\n# => "} # ) end |
#features ⇒ Object Also known as: fe
#
features
#
1724 1725 1726 1727 1728 1729 1730 1731 |
# File 'lib/roebe/custom_methods/module.rb', line 1724 def features $LOADED_FEATURES.sort! e e $LOADED_FEATURES.each {|entry| e entry } e e end |
#feedback_base_class ⇒ Object
#
feedback_base_dir
This will feedback the code we may use to
#
1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 |
# File 'lib/roebe/custom_methods/module.rb', line 1791 def feedback_base_class _ = ENV['RUBY_SRC'].to_s+'/' path = return_pwd.gsub(/#{_}/,'') path.gsub!(/lib\//,'') if path.include? 'lib/' result = ''.dup result << "require '#{path}/base/base.rb'" result << '; < ::'+path.capitalize.to_s+'::Base' set_xorg_buffer(result) e result end |
#feedback_base_dir ⇒ Object Also known as: base_project?
#
feedback_base_dir
#
1498 1499 1500 |
# File 'lib/roebe/custom_methods/module.rb', line 1498 def feedback_base_dir ::Roebe.feedback_base_dir end |
#feedback_help_about_raise ⇒ Object
#
feedback_help_about_raise
#
1685 1686 1687 |
# File 'lib/roebe/custom_methods/module.rb', line 1685 def feedback_help_about_raise e "raise ArgumentError, 'Argument is not numeric' unless x.is_a? Numeric" end |
#feedback_ruby_keywords ⇒ Object
#
feedback_ruby_keywords
Show all available keywords of ruby, via this method.
#
99 100 101 102 103 104 105 |
# File 'lib/roebe/custom_methods/module.rb', line 99 def feedback_ruby_keywords result = ''.dup self.ruby_keywords?.each {|keyword| result << keyword+', ' } result.strip! result.chop! e result end |
#fetch_gimp ⇒ Object Also known as: update_gimp
#
fetch_gimp
Use this to fetch gimp from the latest git sources.
#
3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 |
# File 'lib/roebe/custom_methods/module.rb', line 3081 def fetch_gimp require 'esystem' require 'totarxz' the_date = Time.now.strftime '%d.%m.%Y' base_dir = HOME_DIRECTORY_OF_USER_X+'SRC/gimp/' cd(base_dir) e 'We are now in the directory `'+sdir(base_dir)+'`.' _ = 'git clone git://git.gnome.org/gimp' esystem _ e 'Next renaming the dir `'+sdir(the_date)+'`.' the_dir = 'gimp-'+the_date rename 'gimp', the_dir old_dir = Dir.pwd cd the_dir remove('.gitignore') remove('.git/') cd old_dir ToTarXz[the_dir] end |
#fetch_page(which_page = 'http://www.google.at') ⇒ Object Also known as: fet, www_open, open_www
#
fetch
This is a simple web_fetcher.
Commandline invocation example:
rinvoke fetch derstandard.at
Example in ruby code:
result = www_open 'http://www.ebi.ac.uk/ena/data/view/M80805&display=fasta'
x = www_open 'http://www.zamg.ac.at/cms/de/wetter/wetterwerte-analysen/wien'
#
5055 5056 5057 5058 5059 5060 |
# File 'lib/roebe/custom_methods/module.rb', line 5055 def fetch_page(which_page = 'http://www.google.at') e 'heureka ...' if which_page[0,'http://'.size] == 'http://' result = open(which_page).read # .read(1024) # If we need to limit it. e result return result end |
#fib(input = 10) ⇒ Object
#
fib
rinvoke fib
#
1816 1817 1818 |
# File 'lib/roebe/custom_methods/module.rb', line 1816 def fib(input = 10) input.times { |i| print StdMath.fib(i).to_s+' ' }; puts end |
#fibonacci(i = ARGV.first) ⇒ Object
#
fibonacci
rinvoke fibonacci 10
#
4038 4039 4040 |
# File 'lib/roebe/custom_methods/module.rb', line 4038 def fibonacci(i = ARGV.first) Roebe.fibonacci(i) end |
#file_ending(i = ARGV.first) ⇒ Object
#
file_ending
#
3881 3882 3883 3884 |
# File 'lib/roebe/custom_methods/module.rb', line 3881 def file_ending(i = ARGV.first) cmd = 'find . -type f -name \*.'+i esystem cmd end |
#fill_up_with_this_token(amount = 10, my_token = ' ') ⇒ Object
#
fill_up_with_this_token
#
4784 4785 4786 4787 4788 |
# File 'lib/roebe/custom_methods/module.rb', line 4784 def fill_up_with_this_token(amount = 10, my_token = ' ') tmp = '' 0.upto(amount) { |h| tmp << my_token } return tmp end |
#filter_ansi(i) ⇒ Object Also known as: fansi
#
filter_ansi
fansi “ä”
#
984 985 986 |
# File 'lib/roebe/custom_methods/module.rb', line 984 def filter_ansi(i) i.gsub(/\e[^a-z]+[a-z]/, '') end |
#find_duplicates ⇒ Object
#
find_duplicates
I use this to find duplicates in the code.
How to find duplicated when clauses here:
#
4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 |
# File 'lib/roebe/custom_methods/module.rb', line 4500 def find_duplicates input_file = ENV['RUBY_SRC'].to_s+'/beautiful_url/lib/beautiful_url/toplevel_methods/beautiful_menu.rb' x = File.readlines(input_file) y = x.join("\n").grep(/^ +when/).join(' ').gsub(/when/,'').gsub(/','/,' ') z = y.split(' ').join(' ').gsub(/,/,' ').squeeze(' ').split(' ').join(' ') # gsub(/'/,' ') pp z hash = Hash.new(0) z.scan(/\w+\??/) { |word| hash[word] += 1 } e 'Results are:' pp hash.select {|key, value| pp key if value.to_i > 1} end |
#find_object(the_object_id) ⇒ Object
#
find_object
find_object -607869178 y = find_object -608122768
#
1917 1918 1919 1920 1921 |
# File 'lib/roebe/custom_methods/module.rb', line 1917 def find_object(the_object_id) # ObjectSpace.each_object {|o| break o if o.object_id == the_object_id} # ObjectSpace.each_object {|o| return o if o.object_id == the_object_id} ObjectSpace._id2ref the_object_id end |
#find_primes ⇒ Object Also known as: primes?
#
find_primes
Find prime numbers via this method.
Commandline invocation:
rinvoke find_primes
#
1006 1007 1008 1009 1010 |
# File 'lib/roebe/custom_methods/module.rb', line 1006 def find_primes for index in 2..35000 do puts index unless (2..index-1).find { |j| index % j == 0 } end end |
#find_rdoc_docu(i = ARGV.first, format_type = '--format=markdown') ⇒ Object
#
find_rdoc_docu
rinvoke find_rdoc_docu
#
3911 3912 3913 3914 |
# File 'lib/roebe/custom_methods/module.rb', line 3911 def find_rdoc_docu(i = ARGV.first, format_type = '--format=markdown') require 'show_rdoc_docu' ShowRdocDocu.new(i, format_type) end |
#fix_filenames ⇒ Object
#
fix_filenames
Generic method to fix filenames in the current directory. Should be adapted to the specific use case that you currently have.
#
5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 |
# File 'lib/roebe/custom_methods/module.rb', line 5154 def fix_filenames old_files = Dir['*'] old_files.each {|file| if file.include? 'WIEN' # Downcase to Wien. new_filename = file.gsub(/WIEN/,'Wien') e "Renaming #{sfile(file)} to #{sfile(new_filename)}." mv(file, new_filename) end } end |
#fix_pidgin ⇒ Object Also known as: fix_icq
#
fix_pidgin
Fix the crappy pidgin config.
#
2852 2853 2854 2855 2856 |
# File 'lib/roebe/custom_methods/module.rb', line 2852 def fix_pidgin target = File.('~/.gtkrc-2.0') e "Copying gtkrc to #{target} next (this will fix the Pidgin keybindings)" copy_file ENV['LINUX'].to_s+'/GTK/gtkrc', target end |
#fsize(file = '/Depot/Temp/Multiaterm.desktop') ⇒ Object
#
fsize
#
4919 4920 4921 4922 4923 4924 4925 |
# File 'lib/roebe/custom_methods/module.rb', line 4919 def fsize(file = '/Depot/Temp/Multiaterm.desktop') x = File.stat(file).size? y = x/1000 z = y/1000 a = z.to_f/1000 e y.to_s+' KB, '+z.to_s+' MB, '+a.to_s+'GB' end |
#fstat(file = '/index.php') ⇒ Object
#
fstat
#
382 383 384 |
# File 'lib/roebe/custom_methods/module.rb', line 382 def fstat(file = '/index.php') e File.lstat(file) end |
#gem_install ⇒ Object
#
gem_install
#
4619 4620 4621 |
# File 'lib/roebe/custom_methods/module.rb', line 4619 def gem_install ::Roebe.gem_install end |
#gem_install_script ⇒ Object
#
gem_install_script
require 'x/STD/array_install_these_gem_projects.rb'
rinvoke gem_install_script
#
4953 4954 4955 4956 4957 |
# File 'lib/roebe/custom_methods/module.rb', line 4953 def gem_install_script ARRAY_INSTALL_THESE_GEM_PROJECTS.each {|name| e ' wget '+name } end |
#gemi(i) ⇒ Object
#
gemi
Install a gem as user.
#
2816 2817 2818 2819 |
# File 'lib/roebe/custom_methods/module.rb', line 2816 def gemi(i) _ = 'gem install --user-install '+i.to_s esystem _ end |
#generate_cookbooks_completions ⇒ Object
#
generate_cookbooks_completions
rinvoke generate_cookbooks_completions
This will be stored at:
bl /Depot/Temp/rbt_completion.sh
#
2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 |
# File 'lib/roebe/custom_methods/module.rb', line 2187 def generate_cookbooks_completions require 'rbt' require 'generate_shell_completion' array = RBT.programs? array << RBT.cookbook_aliases?.keys array.flatten! store_here = '/Depot/Temp/rbt_completion.sh' _ = GenerateShellCompletion::GenerateShellCompletion.new(ARGV, :dont_run_yet) _.set_name_of_the_shell_function 'completion_for_ry' _.set_aliases 'rf' _.set_dataset(array) _.store_here store_here _.use_files_in_directory_as_well e 'We will store at `'+Colours.sfile(store_here)+'`.' _.remove_old_file # ======================================================================= # # Which aliases to use here. # ======================================================================= # use_these_aliases = %w( ry url urla wis co cookbook sload tags coptions? coptions blfs ecompile ) _.set_aliases use_these_aliases _.run target = '/home/x/data/PC/OS/LINUX/SHELL/SCRIPTS/'+File.basename(store_here) e "We will store at #{Colours.sfile(target)}." _.store_here target _.run end |
#generate_html_table_for_individuelles_curriculum ⇒ Object
#
generate_html_table_for_individuelles_curriculum
#
5266 5267 5268 |
# File 'lib/roebe/custom_methods/module.rb', line 5266 def generate_html_table_for_individuelles_curriculum ::Roebe.generate_html_table_for_individuelles_curriculum end |
#generate_lighttpd_configuration ⇒ Object
#
generate_lighttpd_configuration
#
2775 2776 2777 |
# File 'lib/roebe/custom_methods/module.rb', line 2775 def generate_lighttpd_configuration Roebe.generate_lighttpd_configuration end |
#generate_opal_files ⇒ Object
#
generate_opal_files
rinvoke generate_opal_files
#
5085 5086 5087 5088 5089 5090 5091 5092 5093 |
# File 'lib/roebe/custom_methods/module.rb', line 5085 def generate_opal_files require 'opal' where = 'app.js' e 'Now creating '+sfile(where) ::Roebe.write_what_into(Opal.compile("puts 'wow'"), where) where = 'opal.js' e 'Now creating '+sfile(where) ::Roebe.write_what_into(Opal::Builder.build('opal'), where) end |
#generate_random_chars(how_many = 25) ⇒ Object
#
generate_random_chars
This method will simply generates a few random characters.
#
1896 1897 1898 1899 1900 1901 1902 |
# File 'lib/roebe/custom_methods/module.rb', line 1896 def generate_random_chars( how_many = 25 ) array = [] how_many.times {|x| array << ALPHABET.sample } return array end |
#generate_random_numbers(n_times = 10, range = (0..100).to_a) ⇒ Object
#
generate_random_numbers
This will generate random numbers. It returns an array.
pp generate_random_numbers(10, (1..2001).to_a)
rinvoke generate_random_numbers
#
288 289 290 291 292 293 294 295 296 |
# File 'lib/roebe/custom_methods/module.rb', line 288 def generate_random_numbers( n_times = 10, range = (0..100).to_a ) array = [] array_of_available_numbers = range n_times.times { array << array_of_available_numbers.sample } return array end |
#generate_random_string(len = 1_000, shall_we_output_the_result = true) ⇒ Object Also known as: random_string, gsr
#
generate_random_string
Since Jun 2011, we use only alphabetical characters. gsr 100, true gsr 20, true gsr(20, true).downcase
#
2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 |
# File 'lib/roebe/custom_methods/module.rb', line 2890 def generate_random_string(len = 1_000, shall_we_output_the_result = true) result = (0...len).map { rand(36).to_s(36) }.map {|x| (rand < 0.5) ? x:x.upcase }.join result = (0...len).map { $alphabet.sample }.map {|x| (rand < 0.5) ? x:x.upcase }.join e result if shall_we_output_the_result result end |
#generate_rf_completions ⇒ Object
#
generate_rf_completions
gcompletions
#
4932 4933 4934 4935 |
# File 'lib/roebe/custom_methods/module.rb', line 4932 def generate_rf_completions require 'roebe/browser/firefox.rb' ::Roebe.firefox.generate_tab_completions end |
#get_random_image ⇒ Object
#
get_random_image
rinvoke get_random_image
#
2877 2878 2879 2880 |
# File 'lib/roebe/custom_methods/module.rb', line 2877 def get_random_image require 'x/STD/std_includes.rb' _ = get_file_listing(ENV['IMG'].to_s+'/RPG').sample end |
#getch ⇒ Object
#
getch
#
3065 3066 3067 |
# File 'lib/roebe/custom_methods/module.rb', line 3065 def getch STDIN.getch end |
#girls ⇒ Object
#
girls
#
1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 |
# File 'lib/roebe/custom_methods/module.rb', line 1101 def girls %w( girl1 girl2 girl3 girl4 girl6 ).map(&:to_sym).each {|entry| rf entry } end |
#git_colours ⇒ Object
#
git_colours
#
1597 1598 1599 |
# File 'lib/roebe/custom_methods/module.rb', line 1597 def git_colours ::Roebe.git_colours end |
#google_search(search_term = 'ruby') ⇒ Object
#
google_search
#
1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 |
# File 'lib/roebe/custom_methods/module.rb', line 1220 def google_search(search_term = 'ruby') begin;require 'google';require 'cgi';rescue;end key = File.read(File.join(ENV['HOME'], '.google_key')).chomp google = Google::Search.new(key) result = google.search( search_term ) result.resultElements.each_with_index { |block_result, index| printf "\nResult #%d:\n", index puts 'url war: '+block_result.send('url') puts 'title war: '+block_result.send('title') #result.each do |key| # printf("%s = %s\n", key, result.send(key)) #end } end |
#gtk ⇒ Object Also known as: gtk2
#
gtk
#
938 939 940 |
# File 'lib/roebe/custom_methods/module.rb', line 938 def gtk require 'gtk2' end |
#gtk_runner? ⇒ Boolean
#
gtk_runner?
We need the start-position and the end-position.
rinvoke gtk_runner?
#
963 964 965 966 967 968 969 970 |
# File 'lib/roebe/custom_methods/module.rb', line 963 def gtk_runner? # bl $RSRC/gtk_runner/lib/gtk_runner/gtk_runner.rb _ = RUBY_SRC_DIR+'gtk_paradise/lib/gtk_paradise/run.rb' start_line = 567 - 1 # We deduct 1 because Arrays start at 0. end_line = 587 e File.readlines(_)[ start_line..end_line ].map {|entry| entry.gsub(/# /,'' ).delete('#') }.join().to_s end |
#has_readline? ⇒ Boolean
#
has_readline?
Use this method to determine whether your ruby version has readline support or whether it has not.
#
4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 |
# File 'lib/roebe/custom_methods/module.rb', line 4891 def has_readline? begin require 'readline' rescue LoadError; end if Object.const_defined? :Readline e 'Yes, your ruby-version has readline support.' else e 'No, your ruby-version does NOT have readline support.' end end |
#heredocs? ⇒ Boolean
#
heredocs? (eof tag)
This makes an EOF.
#
3764 3765 3766 |
# File 'lib/roebe/custom_methods/module.rb', line 3764 def heredocs? ::Roebe.heredocs? end |
#histogramm(*i) ⇒ Object Also known as: histogram
#
histogramm
This method can be used to quickly generate a graphic, via R, but from within ruby (such as from irb). This exists mostly for reasons of convenience, but it is an ad-hoc method really.
#
1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 |
# File 'lib/roebe/custom_methods/module.rb', line 1436 def histogramm(*i) require 'open' i = i.flatten.compact.map {|entry| entry.strip! entry.to_f }.sort # Let's analyse it next. sum = i.sum e e ' The sum is: '+sum.to_s e ' The average is: '+(sum.to_f / i.size).to_s e into = Roebe.log_dir?+'R_code.R' e 'Next delegating towards the programming language R, via '\ 'the file '+sfile(into)+':' e what = "y = c(#{i.join(', ')});\nhist(y)\n".dup store_into_this_image = Roebe.log_dir?+'foobar.png' what << 'png(filename = "'+store_into_this_image+'")'+"\n" what << 'hist(y)'+"\n" what << 'dev.off()'+"\n" ::Roebe.write_what_into(what, into) cmd = 'R --file='+into esystem cmd if File.exist? store_into_this_image Open.in_browser(store_into_this_image) end end |
#htmlentities(i) ⇒ Object
#
htmlentities
As the PHP’s htmlentities version.
The input to this method should be a String.
Use this as in the following example:
htmlentities('a > x && y < 0') # => "a > x && y < 0"
#
257 258 259 260 |
# File 'lib/roebe/custom_methods/module.rb', line 257 def htmlentities(i) require 'cyberweb/toplevel_methods/escape_html.rb' Cyberweb.htmlentities(i) end |
#images_to_html(from_this_directory = return_pwd) ⇒ Object Also known as: imagestohtml
#
images_to_html
#
3260 3261 3262 3263 3264 3265 |
# File 'lib/roebe/custom_methods/module.rb', line 3260 def images_to_html( from_this_directory = return_pwd ) require 'cyberweb' Cyberweb::ImagesToHtml.new(from_this_directory) end |
#increase_volume(i) ⇒ Object
#
increase_volume
#
730 731 732 |
# File 'lib/roebe/custom_methods/module.rb', line 730 def increase_volume(i) ::Roebe.increase_volume(i) end |
#install_acrobat_reader ⇒ Object
#
install_acrobat_reader
rinvoke install_acrobat_reader
#
4219 4220 4221 4222 4223 4224 |
# File 'lib/roebe/custom_methods/module.rb', line 4219 def install_acrobat_reader name = 'AdobeReader-9.4.2.bin' copy_file '/home/x/src/PDF/'+name,'/Depot/j' cd '/Depot/j' system './'+name end |
#install_and_update_rcfiles ⇒ Object
#
install_and_update_rcfiles
#
5575 5576 5577 |
# File 'lib/roebe/custom_methods/module.rb', line 5575 def install_and_update_rcfiles ::Roebe.install_and_update_rcfiles end |
#install_bcm4318 ⇒ Object Also known as: install_bcm
#
install_bcm4318
This is for the wlan on my laptop. rinvoke install_bcm4318
#
2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 |
# File 'lib/roebe/custom_methods/module.rb', line 2277 def install_bcm4318 e 'Now installing WLAN Driver for the laptop:' append 'blacklist bcm43xx', '/etc/modprobe.d/blacklist' esystem 'ndiswrapper -i '+ENV['SRC']+'/WLAN/DRIVERS/bcmwl5a.inf' esystem 'modprobe bcm43xx' esystem 'iwlist wlan0 scan' esystem 'ndiswrapper -m' esystem 'ifup wlan0' esystem 'iwlist scanning' esystem 'dhclient wlan0' end |
#install_docbook_components ⇒ Object
#
install_docbook_components
This will install the docbook components, including smgl.
rinvoke install_docbook_components
#
5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 |
# File 'lib/roebe/custom_methods/module.rb', line 5277 def install_docbook_components require 'rbt' require 'esystem' # ======================================================================= # # First, we get rid of some already installed things. # ======================================================================= # remove '/etc/xml/' if File.directory? '/etc/xml/' remove '/etc/sgml/' if File.directory? '/etc/sgml/' remove '/usr/share/xml/' if File.directory? '/usr/share/xml/' remove '/usr/share/sgml/' if File.directory? '/usr/share/sgml/' e 'We will install SGML first:' to = '/Depot/Temp/' what = RBT::Cookbooks::SanitizeCookbook.new(:sgmlcommon) name = what.name_and_version? Extracter.extract_what_to(what.path?, to) FileUtils.mkdir('/etc/xml') cd to+name esystem 'patch -Np1 -i *.patch' esystem 'autoreconf -f -i' e esystem './configure --prefix=/usr --sysconfdir=/etc' e esystem 'make' e # Now, as the root user: esystem 'make install' e e 'We will now add to '+sfile('/etc/sgml/sgml-ent.cat') e esystem 'install-catalog --add /etc/sgml/sgml-ent.cat /usr/share/sgml/sgml-iso-entities-8879.1986/catalog'.delete("\n").strip e esystem 'install-catalog --add /etc/sgml/sgml-docbook.cat /etc/sgml/sgml-ent.cat'.delete("\n").strip e # ======================================================================= # # And now we will install docbook-xsl # ======================================================================= # what = RBT::Cookbooks::SanitizeCookbook.new(:docbookxsl) name = what.name_and_version? Extracter.extract_what_to(what.path?, to) cd to+name e esystem "install -v -m755 -d /usr/share/xml/docbook/xsl-stylesheets-1.78.1" e esystem "cp -v -R VERSION common eclipse epub extensions fo highlighting html htmlhelp images javahelp lib manpages params profiling roundtrip slides template tests tools webhelp website xhtml xhtml-1_1 /usr/share/xml/docbook/xsl-stylesheets-1.78.1" e esystem "ln -s VERSION /usr/share/xml/docbook/xsl-stylesheets-1.78.1/VERSION.xsl" e esystem "install -v -m644 -D README /usr/share/doc/docbook-xsl-1.78.1/README.txt".delete("\n").strip e esystem "install -v -m644 RELEASE-NOTES* NEWS* /usr/share/doc/docbook-xsl-1.78.1".delete("\n").strip e unless File.exist? '/etc/xml/catalog' esystem 'xmlcatalog --noout --create /etc/xml/catalog' e end esystem 'xmlcatalog --noout --add "rewriteSystem" "http://docbook.sourceforge.net/release/xsl/1.78.1" "/usr/share/xml/docbook/xsl-stylesheets-1.78.1" /etc/xml/catalog'.delete("\n").strip e esystem 'xmlcatalog --noout --add "rewriteURI" "http://docbook.sourceforge.net/release/xsl/1.78.1" "/usr/share/xml/docbook/xsl-stylesheets-1.78.1" /etc/xml/catalog'.delete("\n").strip e esystem 'xmlcatalog --noout --add "rewriteSystem" "http://docbook.sourceforge.net/release/xsl/current" "/usr/share/xml/docbook/xsl-stylesheets-1.78.1" /etc/xml/catalog'.delete("\n").strip e esystem 'xmlcatalog --noout --add "rewriteURI" "http://docbook.sourceforge.net/release/xsl/current" "/usr/share/xml/docbook/xsl-stylesheets-1.78.1" /etc/xml/catalog'.delete("\n").strip e # ======================================================================= # # Next we could install xml-dtd-4.2/ # ======================================================================= # esystem 'xmlcatalog --noout --add "rewriteSystem" "http://docbook.sourceforge.net/release/xsl/4.2" "/usr/share/xml/docbook/xsl-stylesheets-4.2" /etc/xml/catalog'.delete("\n").strip.tr(' ',' ') esystem 'xmlcatalog --noout --add "rewriteURI" "http://docbook.sourceforge.net/release/xsl/4.2" "/usr/share/xml/docbook/xsl-stylesheets-4.2" /etc/xml/catalog'.delete("\n").strip.tr(' ',' ') # ======================================================================= # # Ok, sgml is now installed. We will install docbook-4.5 next: # ======================================================================= # what = RBT::Cookbooks::SanitizeCookbook.new(:docbook) name = what.name_and_version? Extracter.extract_what_to(what.path?, to) cd to+name e esystem "sed -i -e '/ISO 8879/d' -e '/gml/d' docbook.cat" e esystem "install -v -d /usr/share/sgml/docbook/sgml-dtd-4.5" e esystem "chown -R 0:0 ." e esystem "install -v docbook.cat /usr/share/sgml/docbook/sgml-dtd-4.5/catalog" e esystem "cp -v -af *.dtd *.mod *.dcl /usr/share/sgml/docbook/sgml-dtd-4.5" e esystem "install-catalog --add /etc/sgml/sgml-docbook-dtd-4.5.cat /usr/share/sgml/docbook/sgml-dtd-4.5/catalog".delete("\n").strip e esystem "install-catalog --add /etc/sgml/sgml-docbook-dtd-4.5.cat /etc/sgml/sgml-docbook.cat".delete("\n").strip e # ======================================================================= # # Now we install docbook-4.2: # ======================================================================= # what = HOME_DIRECTORY_OF_USER_X+'src/docbook/docbook-4.5.tar.xz' name = File.basename(what).gsub(/\.tar\.xz$/, '') Extracter.extract_what_to(what, to) cd to+name e esystem "sed -i -e '/ISO 8879/d' -e '/gml/d' docbook.cat" e esystem "install -v -d /usr/share/sgml/docbook/sgml-dtd-4.2" e esystem "chown -R 0:0 ." e esystem "install -v docbook.cat /usr/share/sgml/docbook/sgml-dtd-4.2/catalog" e esystem "cp -v -af *.dtd *.mod *.dcl /usr/share/sgml/docbook/sgml-dtd-4.2" e esystem "install-catalog --add /etc/sgml/sgml-docbook-dtd-4.2.cat /usr/share/sgml/docbook/sgml-dtd-4.5/catalog".delete("\n").strip e esystem "install-catalog --add /etc/sgml/sgml-docbook-dtd-4.2.cat /etc/sgml/sgml-docbook.cat".delete("\n").strip e end |
#install_geany_addons ⇒ Object
#
install_geany_addons
Use this method to install geany addons.
#
3236 3237 3238 3239 3240 |
# File 'lib/roebe/custom_methods/module.rb', line 3236 def install_geany_addons e 'Installing geany addons (geany-plugins) next.' require 'rbt' RBT::Installer.new('geany-plugins') end |
#install_in_ruby_gem_manner(optional_copy_the_gem_to_this_location = nil) ⇒ Object
#
install_in_ruby_gem_manner
#
1717 1718 1719 |
# File 'lib/roebe/custom_methods/module.rb', line 1717 def install_in_ruby_gem_manner(optional_copy_the_gem_to_this_location = nil) ::Roebe.install_in_ruby_gem_manner(optional_copy_the_gem_to_this_location) end |
#install_in_ruby_setup_manner ⇒ Object Also known as: r2
#
install_in_ruby_setup_manner
This is similar to the r2 alias.
#
1240 1241 1242 1243 |
# File 'lib/roebe/custom_methods/module.rb', line 1240 def install_in_ruby_setup_manner require 'roebe/classes/update.rb' ::Roebe.install_in_ruby_setup_manner end |
#install_java ⇒ Object Also known as: installjava
#
install_java
rinvoke installjava
#
4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 |
# File 'lib/roebe/custom_methods/module.rb', line 4847 def install_java require 'rbt' require 'fileutils' _ = RCreateProgram.new 'java-1.5.0.09' _.create_directories java_package = 'jdk-1.5.0.09' java_package << '.bin' _ = ENV['J'] FileUtils.cp '/home/x/SRC/java/'+java_package, _ cd _ system 'sh '+java_package end |
#install_lampp ⇒ Object
#
install_lampp
#
2254 2255 2256 2257 2258 2259 2260 |
# File 'lib/roebe/custom_methods/module.rb', line 2254 def install_lampp require 'extracter' extract_to = '/opt/' what = ENV['SRC']+'/LAMPP/lampp.tar.xz' e 'Now trying to extract '+what+':' Extracter.new(what, extract_to, true) end |
#install_my_gems ⇒ Object
#
install_my_gems
This method will install all my local gems.
#
4942 4943 4944 |
# File 'lib/roebe/custom_methods/module.rb', line 4942 def install_my_gems ::Roebe.install_my_gems end |
#install_openoffice ⇒ Object Also known as: openoffice, install_libreoffice, ioffice
#
install_openoffice (openoffice tag, ooffice tag, roffice)
This method will install libreoffice, by making use of class Roebe::InstallLibreoffice for this job.
rinvoke openoffice
#
3181 3182 3183 3184 |
# File 'lib/roebe/custom_methods/module.rb', line 3181 def install_openoffice require 'roebe/classes/install_libreoffice/install_libreoffice.rb' InstallLibreoffice.new end |
#install_opera ⇒ Object
#
install_opera
Install opera here.
#
4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 |
# File 'lib/roebe/custom_methods/module.rb', line 4831 def install_opera what = ENV['SRC']+'/OPERA/opera-11.51-1087.i386.linux.tar.bz2' cp what, ENV['MY_TEMP'] cd ENV['MY_TEMP'] extract File.basename(what) cd File.basename(what) puts 'In Directory '+return_pwd RBT.create_program cpr '.', ENV['MY_PROGRAMS']+'/Opera/Current/' end |
#install_postgresql ⇒ Object
#
install_postgresql
rinvoke install_postgresql
#
2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 |
# File 'lib/roebe/custom_methods/module.rb', line 2729 def install_postgresql e 'We will initialize a database cluster next.' # esystem 'adduser postgre' user_id = '51' # This will be the userid of the postgres user. esystem 'install -v -dm700 /srv/pgsql/data' esystem 'install -v -dm755 /run/postgresql' esystem 'groupadd -g '+user_id+' postgres' esystem 'useradd -c "PostgreSQL Server" -g postgres -d /srv/pgsql/data -u '+user_id+' postgres' esystem 'chown -Rv postgres:postgres /srv/pgsql /run/postgresql' esystem "su - postgres -c '/usr/bin/initdb -D /srv/pgsql/data'" # Next start the database-cluster. esystem "su - postgres -c '/usr/bin/postmaster -D /srv/pgsql/data > /srv/pgsql/data/logfile 2>&1 &'" # Next, create a database and verify the installation: esystem "su - postgres -c '/usr/bin/createdb test'" command = <<-EOF echo "create table t1 ( name varchar(20), state_province varchar(20) );" \ | (su - postgres -c '/usr/bin/psql test ') && echo "insert into t1 values ('Billy', 'NewYork');" \ | (su - postgres -c '/usr/bin/psql test ') && echo "insert into t1 values ('Evanidus', 'Quebec');" \ | (su - postgres -c '/usr/bin/psql test ') && echo "insert into t1 values ('Jesse', 'Ontario');" \ | (su - postgres -c '/usr/bin/psql test ') && echo "select * from t1;" | (su - postgres -c '/usr/bin/psql test') EOF esystem command end |
#install_roebe_addons ⇒ Object
#
install_roebe_addons
#
1640 1641 1642 |
# File 'lib/roebe/custom_methods/module.rb', line 1640 def install_roebe_addons ::Roebe.install_roebe_addons end |
#install_this_deb_file(deb_file) ⇒ Object
#
install_this_deb_file
This method will install a debian .deb file.
#
1304 1305 1306 1307 |
# File 'lib/roebe/custom_methods/module.rb', line 1304 def install_this_deb_file(deb_file) require 'roebe/classes/install_debian_file.rb' ::Roebe::InstallDebianFile.new(deb_file) end |
#install_usb_tv ⇒ Object
#
install_usb_tv
#
5468 5469 5470 5471 |
# File 'lib/roebe/custom_methods/module.rb', line 5468 def install_usb_tv e 'Now installing USB TV Stick from Pinnacle:' esystem 'modprobe em28xx-dvb' end |
#install_wg111t ⇒ Object Also known as: wlan
#
install_wg111t
rinvoke wlan
#
4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 |
# File 'lib/roebe/custom_methods/module.rb', line 4795 def install_wg111t require 'x/STD/std_includes.rb' src_dir = ENV['SRC'] what = src_dir+'/WINDOWS/DRIVERS/WLAN/WG111T.tar.bz2' extract_to = '/Depot/j' extract_what_to(what, extract_to) cd extract_to cd 'WG111T' esystem 'ndiswrapper -i '+extract_to+'/WG111T/athfmwdl.inf' esystem 'ndiswrapper -i '+extract_to+'/WG111T/netwg11t.inf' esystem 'depmod -a' esystem 'ndiswrapper -l' esystem 'modprobe ndiswrapper' esystem 'ndiswrapper -m' esystem 'dhcpcd -n wlan0' end |
#install_xfce ⇒ Object
#
install_xfce
Use this method to install XFCE.
#
4248 4249 4250 4251 4252 4253 |
# File 'lib/roebe/custom_methods/module.rb', line 4248 def install_xfce require 'rbt/cookbooks/sanitize_cookbook_dataset/sanitize_cookbook_dataset.rb' dataset = RBT::Cookbooks::SanitizeCookbook.new('xfce') location = extract_what_to(dataset.full_path?, '/Depot/Temp/') return location end |
#install_youtube_dl ⇒ Object
#
install_youtube_dl
This method will install youtube-dl in a proper directory.
#
4016 4017 4018 4019 4020 4021 4022 |
# File 'lib/roebe/custom_methods/module.rb', line 4016 def install_youtube_dl require 'rbt' target = '/home/Programs/Youtubedl/1.0.0/' RBT.create_appdir_skeleton('youtubedl-1.0.0') cp_r HOME_DIRECTORY_OF_USER_X+'src/youtubedl/youtube-dl', target+'bin/' RBT.symlink_program(target) end |
#invoke_capitalize(name = ARGV.first) ⇒ Object
#
rinvoke invoke_capitalize
#
3054 3055 3056 3057 3058 3059 3060 |
# File 'lib/roebe/custom_methods/module.rb', line 3054 def invoke_capitalize(name = ARGV.first) # capitalize if File.directory? name rename(name, name.capitalize) else e 'Did not find `'+name+'`-' end end |
#ip?(this_www_address = 'www.ruby-lang.org') ⇒ Boolean
#
ip?
#
4334 4335 4336 4337 |
# File 'lib/roebe/custom_methods/module.rb', line 4334 def ip?(this_www_address = 'www.ruby-lang.org') a = IPSocket.getaddress this_www_address e "The address of #{this_www_address} was #{a}" end |
#is_image_file?(i) ⇒ Boolean
#
is_image_file?
#
2292 2293 2294 |
# File 'lib/roebe/custom_methods/module.rb', line 2292 def is_image_file?(i) %w( jpg png gif ).any? {|f| i.downcase.include?(f) } end |
#is_on_roebe? ⇒ Boolean
#
is_on_roebe?
#
416 417 418 |
# File 'lib/roebe/custom_methods/module.rb', line 416 def is_on_roebe? ENV['IS_ROEBE'].to_s == '1' end |
#iso_encoding(i) ⇒ Object
#
iso_encoding
#
5476 5477 5478 5479 |
# File 'lib/roebe/custom_methods/module.rb', line 5476 def iso_encoding(i) require 'roebe/encoding/encoding.rb' Roebe.ensure_main_encoding(i) end |
#javascriptcomment? ⇒ Boolean
#
javascriptcomment?
#
1907 1908 1909 |
# File 'lib/roebe/custom_methods/module.rb', line 1907 def javascriptcomment? e '/* */' end |
#json(i = nil) ⇒ Object
#
json
#
809 810 811 812 813 814 815 816 817 818 |
# File 'lib/roebe/custom_methods/module.rb', line 809 def json( i = nil ) if i i = File.read(i) if File.exist? i return JSON.parse(i) else # no argument give, hence just require 'json' now. require 'json' end end |
#json_to_hash(from_this_file) ⇒ Object
#
json_to_hash
This method will convert the json data stored in a local file into a Hash for use in ruby.
As argument you have to pass in the path to a local file.
#
5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 |
# File 'lib/roebe/custom_methods/module.rb', line 5449 def json_to_hash( from_this_file ) require 'json' if from_this_file.is_a? Array from_this_file = from_this_file.first end if File.exist? from_this_file file = File.read(from_this_file) hash = JSON.parse(file) return hash # And return our Hash here. else no_file_exists_at(from_this_file) end end |
#keywords? ⇒ Boolean
#
keywords?
#
2032 2033 2034 2035 2036 2037 |
# File 'lib/roebe/custom_methods/module.rb', line 2032 def keywords? require 'irb/ruby-token' return RubyToken::TokenDefinitions.select { |definition| definition[1] == RubyToken::TkId }.map { |definition| definition[2] }.compact.sort end |
#kill_la_files ⇒ Object
#
kill_la_files
rinvoke kill_la_files This will remove all la files.
#
4129 4130 4131 4132 4133 4134 4135 |
# File 'lib/roebe/custom_methods/module.rb', line 4129 def kill_la_files Dir['*/**/*.la'].each { |file| _ = return_pwd+'/'+file # absolute position. puts 'Removing this .la file next: '+_ remove_file(_) } end |
#less(*args) ⇒ Object
#
less
Takes one or more objects (which should respond to the ‘-’ method) and returns the result of applying the ‘-’ method successively to each object
#
1174 1175 1176 1177 1178 1179 |
# File 'lib/roebe/custom_methods/module.rb', line 1174 def less(*args) args=*args less = args.shift args.each { |elem| less -= elem } less end |
#liner(n_times = 80) ⇒ Object Also known as: cliner
#
liner
#
2782 2783 2784 |
# File 'lib/roebe/custom_methods/module.rb', line 2782 def liner(n_times = 80) Cliner[n_times] end |
#link?(i = ARGV) ⇒ Boolean
#
link?
#
754 755 756 |
# File 'lib/roebe/custom_methods/module.rb', line 754 def link?(i = ARGV) Roebe.link?(i) end |
#ll ⇒ Object Also known as: l, showdir, ls
#
ll (ll tag, ls tag, l tag)
#
5594 5595 5596 5597 5598 5599 |
# File 'lib/roebe/custom_methods/module.rb', line 5594 def ll unless Object.const_defined? :DirectoryParadise require 'directory_paradise' end DirectoryParadise::Report.new; '' # The '' is for IRB. end |
#load_path? ⇒ Boolean
#
load_path?
Give us back the load path that Ruby uses.
#
2267 2268 2269 |
# File 'lib/roebe/custom_methods/module.rb', line 2267 def load_path? e $LOAD_PATH end |
#load_wirble ⇒ Object
#
load_wirble
Enable wirble colour support for IRB next.
#
3279 3280 3281 |
# File 'lib/roebe/custom_methods/module.rb', line 3279 def load_wirble ::Roebe.load_wirble end |
#main_test(i = ARGV) ⇒ Object Also known as: test2
#
main_test
This is a test-method.
You can use it like so:
test2 htop --appdir
#
1872 1873 1874 1875 1876 |
# File 'lib/roebe/custom_methods/module.rb', line 1872 def main_test(i = ARGV) require 'rbt/cookbooks/class.rb' object = RBT::Cookbooks::SanitizeCookbookDataset.new(i) e object.prefix? end |
#make_cookbooks_gem ⇒ Object
#
make_cookbooks_gem
This method will publish a proper cookbooks gem, with all yaml file entries. Afterwards, it will remove that directory.
To trigger this, do:
make_cookbooks_gem
#
4674 4675 4676 4677 |
# File 'lib/roebe/custom_methods/module.rb', line 4674 def make_cookbooks_gem # rinvoke make_cookbooks_gem require 'rbt' RBT::MakeCookbooksGem.new # bl $RUBY_TOOLS/make_cookbooks_gem.rb end |
#make_gem ⇒ Object
#
make_gem
#
182 183 184 |
# File 'lib/roebe/custom_methods/module.rb', line 182 def make_gem ::Roebe.make_gem end |
#make_pdf ⇒ Object
#
make_pdf
Use this to test the generation of .pdf files. rinvoke make_pdf
#
2946 2947 2948 2949 2950 2951 2952 |
# File 'lib/roebe/custom_methods/module.rb', line 2946 def make_pdf require 'pdf' pdf = PDF.new :default pdf.cell(50, 30, 'Testing.') _ = '/yo.pdf' pdf.create_then_open(_) end |
#manual ⇒ Object
#
manual
#
3841 3842 3843 |
# File 'lib/roebe/custom_methods/module.rb', line 3841 def manual Roebe::Shell.create_manual end |
#married ⇒ Object
#
married
#
167 168 169 170 |
# File 'lib/roebe/custom_methods/module.rb', line 167 def married require 'multimedia_paradise' MultimediaParadise.video_player(:married_with_children) end |
#married_with_children ⇒ Object
#
married_with_children
#
3701 3702 3703 |
# File 'lib/roebe/custom_methods/module.rb', line 3701 def married_with_children ::Roebe.play_random_married_with_children_video end |
#mbr? ⇒ Boolean
#
mbr?
rinvoke mbr?
#
232 233 234 |
# File 'lib/roebe/custom_methods/module.rb', line 232 def mbr? pp File.open('/dev/sda') {|f| f.read(512) } # Using pp here is the right thing to do. end |
#mechanize ⇒ Object
#
mechanize
#
931 932 933 |
# File 'lib/roebe/custom_methods/module.rb', line 931 def mechanize require 'mechanize' end |
#meduni? ⇒ Boolean
#
meduni?
#
1692 1693 1694 1695 1696 1697 |
# File 'lib/roebe/custom_methods/module.rb', line 1692 def meduni? e(_ = BeautifulUrl[:meduni]) set_xorg_buffer(_) e BeautifulUrl[:meduni_mail] Passwords.password_for :meduni, :do_not_modify_the_xorg_buffer # bl $RUBY_TOOLS/passwords.rb end |
#mem?(i) ⇒ Boolean
#
mem?
#
975 976 977 |
# File 'lib/roebe/custom_methods/module.rb', line 975 def mem?(i) ObjectSpace.memsize_of(i) end |
#merge_via_prawn ⇒ Object
#
merge_via_prawn
Here we test how merging works through prawn. Unfortunately it does not work.
#
4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 |
# File 'lib/roebe/custom_methods/module.rb', line 4965 def merge_via_prawn # rinvoke merge_via_prawn require 'prawn' pdf_file_paths = %w( one.pdf two.pdf three.pdf ) store_new_pdf_here = 'result.pdf' Prawn::Document.generate(store_new_pdf_here, {page_size: 'A4', skip_page_creation: true}) { |pdf| pdf_file_paths.each { |pdf_file| if File.exists? pdf_file pdf_temp_nb_pages = Prawn::Document.new(template: pdf_file).page_count (1..pdf_temp_nb_pages).each { |i| pdf.start_new_page(template: pdf_file, template_page: i) } end } } e 'We should have stored into '+store_new_pdf_here+'.' end |
#methods?(from_this_module = Roebe) ⇒ Boolean
#
methods?
To use this in simpleirb, do:
require 'x/STD/custom_methods.rb'; methods?
#
5248 5249 5250 5251 5252 |
# File 'lib/roebe/custom_methods/module.rb', line 5248 def methods?(from_this_module = Roebe) all_class_methods = from_this_module.methods(false).sort all_instance_methods = from_this_module.instance_methods(false).sort return all_class_methods + all_instance_methods end |
#mini_fix_libtool_files ⇒ Object
#
mini_fix_libtool_files
This will fix libtool .la files in the current directory.
#
2577 2578 2579 2580 |
# File 'lib/roebe/custom_methods/module.rb', line 2577 def mini_fix_libtool_files require 'rbt' RBT.fix_libtool_files end |
#misc ⇒ Object
#
misc (misc tag)
Throwaway testing method.
#
1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 |
# File 'lib/roebe/custom_methods/module.rb', line 1516 def misc # ======================================================================= # # batchrename # ======================================================================= # start_position = 51 down_to_position = 19 start_position.downto(down_to_position).each {|counter| filename_in = 'tears_of_ice_'+counter.to_s+'.ascii' filename_out = 'tears_of_ice_'+(counter+1).to_s+'.ascii' _ = 'mv '+filename_in+' '+filename_out e _ system _ } # tears_of_ice_45.ascii end |
#mixed_case(i) ⇒ Object
#
mixed_case
#
3452 3453 3454 |
# File 'lib/roebe/custom_methods/module.rb', line 3452 def mixed_case(i) i.downcase.gsub(/\b\w/, &:upcase) end |
#moleculargewicht(i) ⇒ Object
#
moleculargewicht
#
4326 4327 4328 4329 |
# File 'lib/roebe/custom_methods/module.rb', line 4326 def moleculargewicht(i) require 'chemistry_paradise' e i+': '+ChemistryParadise.berechne_atomgewicht(i).to_s end |
#month ⇒ Object
#
month
Show the current month.
#
4102 4103 4104 |
# File 'lib/roebe/custom_methods/module.rb', line 4102 def month StdConstants::CURRENT_MONTH end |
#mp3_to_ogg(i = ARGV) ⇒ Object
#
mp3_to_ogg
#
189 190 191 192 193 194 195 196 197 198 |
# File 'lib/roebe/custom_methods/module.rb', line 189 def mp3_to_ogg(i = ARGV) unless Object.const_defined? :MultimediaParadise require 'multimedia_paradise' end if i.is_a? Array i.each {|entry| mp3_to_ogg(entry) } else MultimediaParadise::MultimediaConversions.mp3_to_ogg(i) end end |
#multi_ascii_splitter(char_limit, *args) ⇒ Object Also known as: mas
#
multi_ascii_splitter
#
5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 |
# File 'lib/roebe/custom_methods/module.rb', line 5524 def multi_ascii_splitter( char_limit, *args ) e " Arg leng is #{args.length} " if MY_DEBUG == 1 ary_entries = args.length n = 1 char_count = 0 loop { break if n == ary_entries if n % 2 == 1 print args[n] if n % 2 == 0 args[n].times { print args[n-1] } char_count += args[n] end n += 1 puts if char_count == char_limit+1 } e char_count if MY_DEBUG == 1 end |
#mv(old_file, new_file, be_verbose = false) ⇒ Object Also known as: move_file
#
mv (mv tag)
#
2299 2300 2301 2302 2303 2304 2305 |
# File 'lib/roebe/custom_methods/module.rb', line 2299 def mv( old_file, new_file, be_verbose = false ) ::Roebe.mv(old_file, new_file, be_verbose) end |
#my_sym(target_location = ) ⇒ Object
#
my_sym
With this method we symlink ALL FILES in this_dir() to the (argument)location which defaults to /System/Executable It must be symlinked including the full absolute dir
Example:
my_sym "/System/Headers/SDL"
my_sym "/usr/lib/pkgconfig"
#
4447 4448 4449 4450 4451 4452 4453 4454 |
# File 'lib/roebe/custom_methods/module.rb', line 4447 def my_sym(target_location = ENV['SYSBIN']) e 'Starting to Symlink' Dir.foreach( Dir.pwd ) { |tmp_var| next if tmp_var.start_with? '.' e 'Symlinking '+Dir.pwd+'/'+tmp_var+' to '+target_location+'/'+tmp_var File.symlink(Dir.pwd+"/"+tmp_var,target_location+'/'+tmp_var) } end |
#n_words(from_this_file = ARGV) ⇒ Object
#
n_words
n_words BLAAS
#
3901 3902 3903 3904 |
# File 'lib/roebe/custom_methods/module.rb', line 3901 def n_words(from_this_file = ARGV) from_this_file = from_this_file.first if from_this_file.is_a? Array e File.read(from_this_file).scan(/\w+/).count.to_s+' words.' end |
#nano_addons ⇒ Object
#
nano_addons
#
1590 1591 1592 |
# File 'lib/roebe/custom_methods/module.rb', line 1590 def nano_addons ::Roebe.nano_addons end |
#ndirs?(i = Dir.pwd, output_result = true) ⇒ Boolean
#
ndirs?
This method will report how many directories are in this dir.
#
1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 |
# File 'lib/roebe/custom_methods/module.rb', line 1342 def ndirs?(i = Dir.pwd, output_result = true) all_entries = get_all_files _ = all_entries.reject {|x| ! File.directory?(x)} _ = _.size if output_result e _ else return _ end end |
#newstud10 ⇒ Object
#
newstud10
#
2453 2454 2455 |
# File 'lib/roebe/custom_methods/module.rb', line 2453 def newstud10 ::Roebe.newstud10 end |
#newstud11 ⇒ Object
#
newstud11
#
2460 2461 2462 |
# File 'lib/roebe/custom_methods/module.rb', line 2460 def newstud11 ::Roebe.newstud11 end |
#newstud12 ⇒ Object
#
newstud12
#
2467 2468 2469 |
# File 'lib/roebe/custom_methods/module.rb', line 2467 def newstud12 ::Roebe.newstud12 end |
#newstud13 ⇒ Object
#
newstud13
#
2474 2475 2476 |
# File 'lib/roebe/custom_methods/module.rb', line 2474 def newstud13 ::Roebe.newstud13 end |
#newstud14 ⇒ Object
#
newstud14
#
2481 2482 2483 |
# File 'lib/roebe/custom_methods/module.rb', line 2481 def newstud14 ::Roebe.newstud14 end |
#newstud15 ⇒ Object
#
newstud15
#
2488 2489 2490 |
# File 'lib/roebe/custom_methods/module.rb', line 2488 def newstud15 ::Roebe.newstud15 end |
#newstud16 ⇒ Object
#
newstud16
#
2495 2496 2497 |
# File 'lib/roebe/custom_methods/module.rb', line 2495 def newstud16 ::Roebe.newstud16 end |
#newstud17 ⇒ Object
#
newstud17
#
2502 2503 2504 |
# File 'lib/roebe/custom_methods/module.rb', line 2502 def newstud17 ::Roebe.newstud17 end |
#newstud18 ⇒ Object
#
newstud18
#
2509 2510 2511 |
# File 'lib/roebe/custom_methods/module.rb', line 2509 def newstud18 ::Roebe.newstud18 end |
#newstud19 ⇒ Object
#
newstud19
#
2516 2517 2518 |
# File 'lib/roebe/custom_methods/module.rb', line 2516 def newstud19 ::Roebe.newstud19 end |
#newstud2 ⇒ Object
#
newstud2
#
2400 2401 2402 |
# File 'lib/roebe/custom_methods/module.rb', line 2400 def newstud2 ::Roebe.newstud2 end |
#newstud20 ⇒ Object
#
newstud20
#
2523 2524 2525 |
# File 'lib/roebe/custom_methods/module.rb', line 2523 def newstud20 ::Roebe.newstud20 end |
#newstud3 ⇒ Object
#
newstud3
This makes the tertiary newstud setting.
#
2393 2394 2395 |
# File 'lib/roebe/custom_methods/module.rb', line 2393 def newstud3 ::Roebe.newstud3 end |
#newstud4 ⇒ Object
#
newstud4
This makes the quaternary newstud setting.
#
2409 2410 2411 |
# File 'lib/roebe/custom_methods/module.rb', line 2409 def newstud4 ::Roebe.newstud4 end |
#newstud5 ⇒ Object
#
newstud5
This makes the fifth newstud setting.
#
2418 2419 2420 |
# File 'lib/roebe/custom_methods/module.rb', line 2418 def newstud5 ::Roebe.newstud5 end |
#newstud6 ⇒ Object
#
newstud6
#
2425 2426 2427 |
# File 'lib/roebe/custom_methods/module.rb', line 2425 def newstud6 ::Roebe.newstud6 end |
#newstud7 ⇒ Object
#
newstud7
#
2432 2433 2434 |
# File 'lib/roebe/custom_methods/module.rb', line 2432 def newstud7 ::Roebe.newstud7 end |
#newstud8 ⇒ Object
#
newstud8
#
2439 2440 2441 |
# File 'lib/roebe/custom_methods/module.rb', line 2439 def newstud8 ::Roebe.newstud8 end |
#newstud9 ⇒ Object
#
newstud9
#
2446 2447 2448 |
# File 'lib/roebe/custom_methods/module.rb', line 2446 def newstud9 ::Roebe.newstud9 end |
#no_audio(file = ARGV.first) ⇒ Object
#
no_audio
#
350 351 352 353 |
# File 'lib/roebe/custom_methods/module.rb', line 350 def no_audio(file = ARGV.first) require 'multimedia_paradise/audio/remove_audio.rb' MultimediaParadise.remove_audio(file) end |
#non_ascii ⇒ Object
#
non_ascii
This method will remove the .ascii suffix from files.
#
1613 1614 1615 |
# File 'lib/roebe/custom_methods/module.rb', line 1613 def non_ascii ::Roebe.non_ascii end |
#objects? ⇒ Boolean
#
objects?
This method will retrieve all objects in ObjectSpace.
#
4582 4583 4584 |
# File 'lib/roebe/custom_methods/module.rb', line 4582 def objects? ObjectSpace.each_object(Class) { |c| printf("%s\n", c.to_s) } end |
#odd_or_even(i) ⇒ Object
#
odd_or_even
Invocation examples:
odd_or_even 555
odd_or_even 42
#
1887 1888 1889 |
# File 'lib/roebe/custom_methods/module.rb', line 1887 def odd_or_even(i) i.odd? ? 'odd':'even' end |
#opal(i) ⇒ Object
#
opal
#
3547 3548 3549 3550 |
# File 'lib/roebe/custom_methods/module.rb', line 3547 def opal(i) require_opal Opal.compile(i) end |
#open? ⇒ Boolean Also known as: ports?
#
open?
Returns all open ports on your system
#
3222 3223 3224 3225 3226 3227 3228 3229 |
# File 'lib/roebe/custom_methods/module.rb', line 3222 def open? require 'x/std/std_modules.rb' require 'socket' StdModules::Ports.open?.each { |open_port| s = Socket.getnameinfo(['AF_INET',open_port, 'localhost']) e "Port #{open_port} (#{s[1]}) ist offen." } end |
#open_in_browser(i = ARGV) ⇒ Object
#
open_in_browser
#
3740 3741 3742 |
# File 'lib/roebe/custom_methods/module.rb', line 3740 def open_in_browser(i = ARGV) ::Roebe.open_in_browser(i) end |
#open_in_editor(i = ARGV) ⇒ Object
#
open_in_editor (open tag)
Open a file in the editor with this method.
#
3615 3616 3617 3618 3619 |
# File 'lib/roebe/custom_methods/module.rb', line 3615 def open_in_editor( i = ARGV ) Roebe.open_in_editor(i) end |
#opnn ⇒ Object
#
opnn
#
3747 3748 3749 |
# File 'lib/roebe/custom_methods/module.rb', line 3747 def opnn ::Roebe.opnn end |
#optionparser? ⇒ Boolean
#
optionparser?
#
5129 5130 5131 |
# File 'lib/roebe/custom_methods/module.rb', line 5129 def optionparser? cat RUBY_SRC_DIR+'test/minimal_optparse_example.rb' end |
#output_array_from_beautiful_menu ⇒ Object
#
rinvoke output_array_from_beautiful_menu
#
1999 2000 2001 2002 2003 2004 2005 2006 |
# File 'lib/roebe/custom_methods/module.rb', line 1999 def require 'case_parser' require 'roebe/requires/failsafe_require_of_beautiful_url.rb' array = CaseParser[RUBY_SRC_DIR+'beautiful_url/lib/beautiful_url/menu/beautiful_menu.rb'].flatten array.each {|entry| e "#{entry} -> #{BeautifulUrl.fetch_value(entry).to_s}" } end |
#pathname ⇒ Object
#
pathname
#
4815 4816 4817 |
# File 'lib/roebe/custom_methods/module.rb', line 4815 def pathname require 'pathname' end |
#pexit(*args) ⇒ Object
#
pexit
To output stuff.
#
2648 2649 2650 2651 |
# File 'lib/roebe/custom_methods/module.rb', line 2648 def pexit(*args) args.each {|entry| e entry } exit end |
#pid ⇒ Object
#
pid
#
4822 4823 4824 |
# File 'lib/roebe/custom_methods/module.rb', line 4822 def pid require 'pidify' end |
#ping(i) ⇒ Object
#
ping
#
2078 2079 2080 |
# File 'lib/roebe/custom_methods/module.rb', line 2078 def ping(i) system i end |
#play(i) ⇒ Object
#
play
#
1468 1469 1470 1471 1472 1473 1474 |
# File 'lib/roebe/custom_methods/module.rb', line 1468 def play(i) if i.is_a? Array i.each {|entry| play(entry) } else esystem 'mplayer '+i end end |
#play_columbo_files(use_this_base_directory = :default, play_n_files = ARGV.first) ⇒ Object Also known as: columbo
#
play_columbo_files
Play all columbo files.
#
1776 1777 1778 1779 1780 1781 1782 1783 1784 |
# File 'lib/roebe/custom_methods/module.rb', line 1776 def play_columbo_files( use_this_base_directory = :default, play_n_files = ARGV.first ) Roebe.play_columbo_files( use_this_base_directory, play_n_files ) end |
#play_midi(i = HOME_DIRECTORY_OF_USER_X+'DATA/AUDIO/MIDI/al_adagi.mid') ⇒ Object
#
play_midi
Play a .mid file through this method.
#
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
# File 'lib/roebe/custom_methods/module.rb', line 360 def play_midi( i = HOME_DIRECTORY_OF_USER_X+'DATA/AUDIO/MIDI/al_adagi.mid' ) if File.exist?(i) require 'midilib' require 'midilib/io/seqreader' seq = MIDI::Sequence.new() # Read the contents of a MIDI file into the sequence. File.open(i, 'rb') { |file| seq.read(file) { |track, num_tracks, track_number| # Print something when each track is read. e "read track #{track_number} of #{num_tracks}" } } else e 'File '+i+' does not exist.' end end |
#play_random_simpsons_movie ⇒ Object Also known as: simpson_movie
#
play_random_simpsons_movie
#
1535 1536 1537 |
# File 'lib/roebe/custom_methods/module.rb', line 1535 def play_random_simpsons_movie ::Roebe.play_random_simpsons_movie end |
#populate_the_main_ENV_variable_with_data_from_custom_yaml_file ⇒ Object
#
populate_the_main_ENV_variable_with_data_from_custom_yaml_file
#
1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 |
# File 'lib/roebe/custom_methods/module.rb', line 1248 def populate_the_main_ENV_variable_with_data_from_custom_yaml_file array_work_on_these_yaml_files = [] array_work_on_these_yaml_files << '/home/x/programming/ruby/src/rcfiles/lib/rcfiles/yaml/system_settings.yml' array_work_on_these_yaml_files << '/home/x/data/personal/yaml/roeberia_settings.yml' array_work_on_these_yaml_files.each {|this_yaml_file| if File.exist? this_yaml_file dataset = YAML.load_file(this_yaml_file) dataset.each_pair {|key, value| key = key.to_s value = value.to_s ENV[key] = value unless ENV.has_key? key } end } end |
#port_str ⇒ Object
#
port_str
This can, on Linux, determine the port_str.
#
241 242 243 |
# File 'lib/roebe/custom_methods/module.rb', line 241 def port_str `ls /dev`.split("\n").grep(/usb|ACM/i).map{|d| "/dev/#{d}"} end |
#ppexit(*args) ⇒ Object
#
ppexit
prettyprint argument, then exit. Useful for debugging.
#
4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 |
# File 'lib/roebe/custom_methods/module.rb', line 4646 def ppexit(*args) args.each { |arg| puts ' ---------------------------------------- ' puts # __FILE__ puts ' In ppexit() of '+$PROGRAM_NAME+',' puts __LINE__.to_s+' the class of our arg (START)' pp arg puts 'was '+arg.class.to_s puts; puts;puts '---' * 80 puts;puts ' :: These were our real arg:' pp arg puts;puts '---' * 80; puts puts ' ---------------------------------------- ' } exit # now exiting. end |
#prepare_gcc ⇒ Object
#
prepare_gcc
This will install the MPFR etc… packages.
#
681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 |
# File 'lib/roebe/custom_methods/module.rb', line 681 def prepare_gcc # pgcc begin require 'rbt' rescue LoadError; end gcc = RBT::Cookbooks::SanitizeCookbooks.new('gcc4') dataset = gcc.data? e 'Now preparing GCC things.' e ' '+dataset['program_path'] dataset = RBT::Cookbooks::SanitizeCookbooks.new('mpfr').data? e '(1) First, we tackle MPFR:' e ' '+dataset['program_path'] # We extract this to the current working directory extract_what_to(dataset['program_path'], return_pwd) symlink dataset['program_name'], dataset['short_name'] dataset = RBT::Cookbooks::SanitizeCookbooks.new('gmp').data? e '(2) First, we tackle GMP:' e ' '+dataset['program_path'] extract_what_to(dataset['program_path'], return_pwd) symlink dataset['program_name'], dataset['short_name'] dataset = RBT::Cookbooks::SanitizeCookbooks.new('mpc').data? e '(2) First, we tackle MPC:' e ' '+dataset['program_path'] extract_what_to(dataset['program_path'], return_pwd) symlink dataset['program_name'], dataset['short_name'] e 'Finished!' end |
#print_indent_pattern(n_times = 3, use_this_token = '*') ⇒ Object
#
print_indent_pattern
print_indent_pattern(3, ‘*’)
Shall output:
***
****
*****
print_indent_pattern(5, ‘+’)
#
3498 3499 3500 3501 3502 3503 3504 3505 3506 |
# File 'lib/roebe/custom_methods/module.rb', line 3498 def print_indent_pattern( n_times = 3, use_this_token = '*' ) n_times.times {|run_number_n| e (' ' * run_number_n)+ use_this_token * (n_times + run_number_n) } end |
#priv ⇒ Object
#
priv
output what ruby can do
#
3858 3859 3860 |
# File 'lib/roebe/custom_methods/module.rb', line 3858 def priv e Object.private_instance_methods.sort end |
#process_kill ⇒ Object
#
kill
Unfinished snippets:
PID killin bot
#
4093 4094 4095 |
# File 'lib/roebe/custom_methods/module.rb', line 4093 def process_kill get_pid { |pid| Process.kill(SIGTERM, @pid) if pid } end |
#pty_spawn ⇒ Object
#
pty_spawn
#
4409 4410 4411 4412 |
# File 'lib/roebe/custom_methods/module.rb', line 4409 def pty_spawn require 'pty' return PTY.spawn end |
#purge_invalid_yaml_directories_from_programs_hierarchy ⇒ Object
#
purge_invalid_yaml_directories_from_programs_hierarchy
#
446 447 448 449 450 |
# File 'lib/roebe/custom_methods/module.rb', line 446 def purge_invalid_yaml_directories_from_programs_hierarchy results = Dir['/Programs/**/**'].select {|entry| entry.end_with? '/yaml' } results.select! {|entry| entry.count('/') == 3 } remove_directory(results) end |
#putssystem(i) ⇒ Object
#
putssystem
#
2917 2918 2919 2920 |
# File 'lib/roebe/custom_methods/module.rb', line 2917 def putssystem(i) e i system i end |
#python_has_bz2? ⇒ Boolean
#
python_has_bz2?
#
823 824 825 |
# File 'lib/roebe/custom_methods/module.rb', line 823 def python_has_bz2? esystem '/usr/bin/python -c "import bz2; print(bz2.__doc__)"' end |
#q ⇒ Object Also known as: rda, qu, qi, i
#
q (q tag, quit tag, Roebe::q)
Custom quit-method - quite useful for IRB in particular.
#
5608 5609 5610 |
# File 'lib/roebe/custom_methods/module.rb', line 5608 def q exit end |
#question1 ⇒ Object
#
question1
#
896 897 898 |
# File 'lib/roebe/custom_methods/module.rb', line 896 def question1 ask_a_question_based_on_this_pwdstud_entry 1 end |
#question2 ⇒ Object
#
question2
#
903 904 905 |
# File 'lib/roebe/custom_methods/module.rb', line 903 def question2 ask_a_question_based_on_this_pwdstud_entry 2 end |
#question3 ⇒ Object
#
question3
#
910 911 912 |
# File 'lib/roebe/custom_methods/module.rb', line 910 def question3 ask_a_question_based_on_this_pwdstud_entry 3 end |
#question4 ⇒ Object
#
question4
#
917 918 919 |
# File 'lib/roebe/custom_methods/module.rb', line 917 def question4 ask_a_question_based_on_this_pwdstud_entry 4 end |
#question5 ⇒ Object
#
question5
#
924 925 926 |
# File 'lib/roebe/custom_methods/module.rb', line 924 def question5 ask_a_question_based_on_this_pwdstud_entry 5 end |
#rack_handlers? ⇒ Boolean
#
rack_handlers?
#
3147 3148 3149 3150 |
# File 'lib/roebe/custom_methods/module.rb', line 3147 def rack_handlers? require 'rack' return Rack::Handler.constants end |
#rails? ⇒ Boolean
#
rails?
#
2796 2797 2798 |
# File 'lib/roebe/custom_methods/module.rb', line 2796 def rails? e 'http://127.0.0.1:3000/' end |
#random_number ⇒ Object
#
random_number
#
4342 4343 4344 |
# File 'lib/roebe/custom_methods/module.rb', line 4342 def random_number e rand(35)+1 end |
#range(up_to_this_number = 10, start_number = 1) ⇒ Object
#
range
range(10,1000,6) <- von 10 bis 1000 gehe in 6-er schritten vor.
#
858 859 860 861 862 863 864 865 866 867 |
# File 'lib/roebe/custom_methods/module.rb', line 858 def range( up_to_this_number = 10, start_number = 1 ) array = [] start_number.upto(up_to_this_number) {|number| array << number } array end |
#raw_dir ⇒ Object
#
raw_dir
Usage example from within irb:
x = raw_dir; x.keys?; filesize = x.filesize?
#
3540 3541 3542 |
# File 'lib/roebe/custom_methods/module.rb', line 3540 def raw_dir return DirectoryParadise::Content.new end |
#raw_read_line(of_this_file = ARGV.first, line_number = ) ⇒ Object
#
raw_read_line
rinvoke read_line zip.rb 2
#
4194 4195 4196 4197 4198 4199 4200 4201 |
# File 'lib/roebe/custom_methods/module.rb', line 4194 def raw_read_line( of_this_file = ARGV.first, line_number = ARGV[1] ) line_number = 1 if line_number.nil? array = File.readlines(of_this_file) e array[line_number.to_i - 1, 1] end |
#raw_readlines(i = nil) ⇒ Object Also known as: read_file, readfile
#
raw_readlines
This method can be problematic in IRB.
#
5584 5585 5586 |
# File 'lib/roebe/custom_methods/module.rb', line 5584 def raw_readlines(i = nil) ::File.readlines(i) if i end |
#rbt ⇒ Object
#
rbt
#
3576 3577 3578 |
# File 'lib/roebe/custom_methods/module.rb', line 3576 def rbt require 'rbt' end |
#rcfiles(i = ARGV) ⇒ Object
#
rcfiles
#
776 777 778 779 780 781 782 783 |
# File 'lib/roebe/custom_methods/module.rb', line 776 def rcfiles(i = ARGV) require 'rcfiles' Rcfiles.parse_commandline(i) if Rcfiles.is_on_roebe? require 'rcfiles/aggregate_all_rcfiles/aggregate_all_rcfiles.rb' Rcfiles::AggregateAllRcfiles.new end end |
#readable_int(num) ⇒ Object
#
readable_int
This one does the following: take a int, and outputs it in easy readable format.
Try it like so:
puts readable_int(555666252) # => 555_666_252
Alternatively use this oneliner:
def readable_int(num); num.to_s.reverse.gsub(/(\d\d\d)\b/,'_\1').reverse; end
#
1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 |
# File 'lib/roebe/custom_methods/module.rb', line 1377 def readable_int(num) cnt = 0 return_value = '' num.to_s.each_char { |tmp| return_value << tmp cnt += 1 return_value << '_' if cnt % 3 == 0 } return_value.chop! if return_value.end_with? '_' return return_value end |
#recursive_method_example(a, b) ⇒ Object
#
recursive_method_example
isEqual(“blah”, “blahblah”)false isEqual(“blah”, “blah”)
#
4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 |
# File 'lib/roebe/custom_methods/module.rb', line 4721 def recursive_method_example(a, b) if a.nil? if b.nil? return true else return false end end if a.empty? and b.empty? return true end char1 = a[0,1] char2 = b[0,1] result = (char1 == char2) if result == false return result # Can never be true. else substring1 = a[1 .. -1] substring2 = b[1 .. -1] if substring1 and substring2 if substring1.empty? and substring2.empty? result = true else result = recursive_method_example( substring1, substring2 ) end else result = false end end return result end |
#register_irc? ⇒ Boolean
#
register_irc?
#
1542 1543 1544 1545 1546 1547 |
# File 'lib/roebe/custom_methods/module.rb', line 1542 def register_irc? require 'xorg_buffer' _ = '/msg nickserv identify 1aaaaaa' e _ set_xorg_buffer(_.chomp) end |
#register_sigint ⇒ Object
#
register_sigint
#
1036 1037 1038 |
# File 'lib/roebe/custom_methods/module.rb', line 1036 def register_sigint self.register_sigint end |
#registered_pipe_actions? ⇒ Boolean
#
registered_pipe_actions?
#
3798 3799 3800 3801 3802 3803 3804 3805 |
# File 'lib/roebe/custom_methods/module.rb', line 3798 def registered_pipe_actions? require 'pipe_handler' require 'colours_e/autoinclude' PipeHandler.allowed_actions.each_with_index {|entry, index| index += 1 e royalblue(index.to_s.rjust(3)+') ')+yellowgreen(entry) } end |
#reject_blanks(input = ARGF.read) ⇒ Object
#
reject_blanks
This method will reject blank entries.
#
1084 1085 1086 1087 |
# File 'lib/roebe/custom_methods/module.rb', line 1084 def reject_blanks(input = ARGF.read) array = input.split("\n").reject {|entry| entry.to_s.empty? } pp array end |
#remote_file_listing(url = 'http://curl.haxx.se/download/') ⇒ Object
#
remote_file_listing
This method allows you to list which files are found at a remote site.
#
2986 2987 2988 2989 2990 2991 2992 |
# File 'lib/roebe/custom_methods/module.rb', line 2986 def remote_file_listing( url = 'http://curl.haxx.se/download/' ) require 'ftp_paradise' _ = FtpParadise.connect to: url pp _.return_entries end |
#remove(i) ⇒ Object
#
remove
#
2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 |
# File 'lib/roebe/custom_methods/module.rb', line 2061 def remove(i) if i.is_a? Array i.each {|entry| remove(entry) } else if File.exist? i # =================================================================== # # We will never remove the / directory, from within the Roebe # project. # =================================================================== # FileUtils.rm_rf(i) unless i.squeeze('/') == '/' end end end |
#remove_all_symlinks ⇒ Object
#
remove_all_symlinks
This method will remove all symlinks from the current working directory.
Invocation example:
rinvoke remove_all_symlinks
#
3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 |
# File 'lib/roebe/custom_methods/module.rb', line 3341 def remove_all_symlinks entries = Dir['*'].select {|entry| ! File.exist?(entry) } entries.each {|entry| e "#{rev}Now working on the entry `#{sfile(entry)}#{rev}`." case File.ftype(entry) when 'link' unless File.exist? entry # ================================================================= # # Remove the missing entry next. # ================================================================= # e "#{rev} → Now removing the entry `#{sfile(entry)}#{rev}`." File.delete(entry) end end } end |
#remove_numbers(input = 'test123') ⇒ Object
#
remove_numbers
#
5075 5076 5077 5078 |
# File 'lib/roebe/custom_methods/module.rb', line 5075 def remove_numbers(input = 'test123') input.gsub!(/\d/,'') e input end |
#remove_old_gem ⇒ Object
#
remove_old_gem
#
3169 3170 3171 |
# File 'lib/roebe/custom_methods/module.rb', line 3169 def remove_old_gem ::Roebe.remove_old_gem end |
#rename(old, new) ⇒ Object
#
rename (rename tag)
#
2696 2697 2698 |
# File 'lib/roebe/custom_methods/module.rb', line 2696 def rename(old, new) FileUtils.mv(old, new) end |
#rename_all ⇒ Object
#
rename_all
To use it, do:
rinvoke rename_all
#
3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 |
# File 'lib/roebe/custom_methods/module.rb', line 3205 def rename_all require 'fileutils' entries = Dir['*'] entries.each {|entry| if entry.include? "\b" new_name = entry.gsub(/\b/,'ü') e rev+'Now renaming `'+sfancy(entry)+rev+'` to `'+new_name+'`.' FileUtils.mv(entry, new_name) end } end |
#rename_ascii_files ⇒ Object
#
rename_ascii_files
This will batch-rename some .ascii files.
#
1507 1508 1509 |
# File 'lib/roebe/custom_methods/module.rb', line 1507 def rename_ascii_files ::Roebe.rename_ascii_files end |
#rep(how_many_times) ⇒ Object
#
rep
rep(3) {|t| puts ‘gekeg’ } rep(3) {|t| puts }
#
1119 1120 1121 |
# File 'lib/roebe/custom_methods/module.rb', line 1119 def rep(how_many_times) how_many_times.times {|t| yield t } end |
#replace_double_underscores ⇒ Object
#
replace_double_underscores
This method will replace __ underscores with _.
#
800 801 802 803 804 |
# File 'lib/roebe/custom_methods/module.rb', line 800 def replace_double_underscores require 'roebe/classes/replace_space_with_underscore/replace_space_with_underscore.rb' array = ['__','_'] Roebe::ReplaceSpaceWithUnderscore.new(array) end |
#report_pwd ⇒ Object Also known as: pwd?, pwd
#
report_pwd
#
2767 2768 2769 |
# File 'lib/roebe/custom_methods/module.rb', line 2767 def report_pwd e ::Colours.steelblue(return_pwd) end |
#require_opal ⇒ Object Also known as: ropal
#
require_opal
#
3555 3556 3557 |
# File 'lib/roebe/custom_methods/module.rb', line 3555 def require_opal require 'opal' end |
#reset_irb ⇒ Object
#
reset_irb
#
1569 1570 1571 |
# File 'lib/roebe/custom_methods/module.rb', line 1569 def reset_irb exec($0) end |
#resize_images_for_my_mom(resize_n_percent = '15') ⇒ Object
#
resize_images_for_my_mom
This should be similar to:
convert terminal.gif -resize 64x64 resize_terminal.gif
#
2379 2380 2381 2382 2383 2384 2385 2386 |
# File 'lib/roebe/custom_methods/module.rb', line 2379 def resize_images_for_my_mom(resize_n_percent = '15') all_images = Dir['*'] all_images.each {|image| _ = 'convert '+image+' -resize '+ resize_n_percent.to_s+'% '+'resized_'+File.basename(image) esystem _ } end |
#restore? ⇒ Boolean
#
restore?
#
3986 3987 3988 3989 3990 3991 |
# File 'lib/roebe/custom_methods/module.rb', line 3986 def restore? e '# Store the state of the terminal' e 'stty_save = `stty -g`.chomp' e 'rescue Interrupt' e "system('stty', stty_save) # Restore" end |
#restore_kde ⇒ Object
#
restore_kde
rinvoke restore_kde
#
1844 1845 1846 |
# File 'lib/roebe/custom_methods/module.rb', line 1844 def restore_kde Roebe::RestoreKde.new end |
#restore_stdout? ⇒ Boolean
#
restore_stdout?
#
2011 2012 2013 |
# File 'lib/roebe/custom_methods/module.rb', line 2011 def restore_stdout? e '$stdout = STDOUT' end |
#ret_ftype(file = '') ⇒ Object
#
ret_ftype
Returns the file type.
#
469 470 471 |
# File 'lib/roebe/custom_methods/module.rb', line 469 def ret_ftype(file = '') file[-3, 3] end |
#return_pwd ⇒ Object
#
return_pwd
#
2760 2761 2762 |
# File 'lib/roebe/custom_methods/module.rb', line 2760 def return_pwd ::Roebe.return_pwd end |
#rev ⇒ Object
#
rev
#
110 111 112 |
# File 'lib/roebe/custom_methods/module.rb', line 110 def rev ::Colours.rev end |
#rf(i) ⇒ Object
#
rf
#
2233 2234 2235 2236 |
# File 'lib/roebe/custom_methods/module.rb', line 2233 def rf(i) require 'roebe/browser/firefox.rb' Roebe.firefox(i) end |
#rfeedback(i = ARGV) ⇒ Object
#
rfeedback
rfeedback gtk2 htop geany
#
4564 4565 4566 4567 4568 |
# File 'lib/roebe/custom_methods/module.rb', line 4564 def rfeedback(i = ARGV) require 'rbt' _ = RBT::NewInstaller.new _.feedback_urls(i) end |
#rm(i) ⇒ Object
#
rm (rm tag)
Remove a file via FileUtils.
#
3975 3976 3977 3978 3979 3980 3981 |
# File 'lib/roebe/custom_methods/module.rb', line 3975 def rm(i) if File.file? i remove_file(i) else FileUtils.rm(i) end end |
#rmax(string = ARGV.first) ⇒ Object
#
rmax
rinvoke max
#
2163 2164 2165 |
# File 'lib/roebe/custom_methods/module.rb', line 2163 def rmax(string = ARGV.first) e string.split("\n").max end |
#roebe_festnetz? ⇒ Boolean
#
roebe_festnetz?
#
489 490 491 492 |
# File 'lib/roebe/custom_methods/module.rb', line 489 def roebe_festnetz? _ = Roebe.actions(:contacts) _.first[1].to_s end |
#roebe_shell(i = ARGV) ⇒ Object Also known as: roebeshell, shell
#
roebe_shell
#
3731 3732 3733 3734 |
# File 'lib/roebe/custom_methods/module.rb', line 3731 def roebe_shell(i = ARGV) require 'roebe/shell/shell/shell.rb' ::Roebe::Shell.new(i) end |
#round(i, round_to_n_places = 3) ⇒ Object
#
round
#
5067 5068 5069 5070 |
# File 'lib/roebe/custom_methods/module.rb', line 5067 def round(i, round_to_n_places = 3) i = i.to_f unless i.is_a? Float return i.round(round_to_n_places) end |
#rsong ⇒ Object
#
rsong
Returns a random song.
#
2689 2690 2691 |
# File 'lib/roebe/custom_methods/module.rb', line 2689 def rsong get_file_listing(ENV['MY_SONGS'].to_s, true).sample end |
#rsplit ⇒ Object
#
rsplit
rinvoke rsplit rsplit ‘slalal:a:asasasf:’
#
2154 2155 2156 |
# File 'lib/roebe/custom_methods/module.rb', line 2154 def rsplit STDIN.read.split(':').each { |_| e _ } end |
#ruby_download(i = ARGV) ⇒ Object
#
ruby_download
#
1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 |
# File 'lib/roebe/custom_methods/module.rb', line 1312 def ruby_download(i = ARGV) if i.is_a? Array i.each {|entry| ruby_download(entry) } else # Do the download here. store_here = File.basename(i) e 'Now storing into the file '+store_here # save_file( open(i, 'rb').read, store_here) open(store_here, 'wb') { |file| file << open(i).read } end end |
#ruby_header ⇒ Object
1057 1058 1059 |
# File 'lib/roebe/custom_methods/module.rb', line 1057 def ruby_header self.ruby_header end |
#ruby_main ⇒ Object
#
ruby_main
rinvoke ruby_main
#
849 850 851 |
# File 'lib/roebe/custom_methods/module.rb', line 849 def ruby_main self.ruby_main end |
#rubycalc(i = ARGV) ⇒ Object
#
rubycalc
#
769 770 771 |
# File 'lib/roebe/custom_methods/module.rb', line 769 def rubycalc(i = ARGV) ::Roebe.rubycalc(i) end |
#rubycol ⇒ Object Also known as: rubycolours
#
rubycol
#
3140 3141 3142 |
# File 'lib/roebe/custom_methods/module.rb', line 3140 def rubycol Colours.test end |
#run_cfdg ⇒ Object
#
run_cfdg
rinvoke run_cfdg
#
3722 3723 3724 3725 3726 |
# File 'lib/roebe/custom_methods/module.rb', line 3722 def run_cfdg require 'image_paradise' @confree_generator = ImageParadise::ConfreeGenerator.new @confree_generator.run_batchmode end |
#sanitize_uptime(inp, language_used = 'german') ⇒ Object
#
sanitize_uptime
We sanitize our uptime. We can lateron generalize this…
#
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
# File 'lib/roebe/custom_methods/module.rb', line 592 def sanitize_uptime(inp, language_used = 'german') inp = inp.to_f wie_viele_stunden = ( inp.to_f/EINE_STUNDE.to_f ).to_i inp -= EINE_STUNDE * wie_viele_stunden wie_viele_minuten = ( inp.to_f/EINE_MINUTE.to_f ).to_i case language_used.downcase when 'german' hours = 'Stunden' minutes = 'Minuten' when 'english' hours = 'Hours' minutes = 'Minutes' else hours = 'unknown unique_90290' minutes = 'unknown unique_90290' end return "#{wie_viele_stunden} #{hours} und #{wie_viele_minuten} #{minutes}" end |
#save_all_contacts ⇒ Object
#
save_all_contacts
This method has been written in June 2023 to save some old email contacts from XML files.
#
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 |
# File 'lib/roebe/custom_methods/module.rb', line 507 def save_all_contacts big_array = custom_parse_this_XML_file_and_extract_email_contact_information dump = YAML.dump(big_array) into = '/Depot/j/contacts.yml' e 'Saving into '+sfile(into)+' next.' SaveFile.write_what_into(dump, into) into = '/Depot/j/contacts.html' e 'Saving into '+sfile(into)+' next.' string = '<table>'.dup big_array.each {|a, b| string << "\n<tr><td>#{a}</td><td>#{b}</td></tr>" } string << '</table>' SaveFile.write_what_into(string, into) end |
#save_yaml(i) ⇒ Object
#
save_yaml
save_yaml 1..100
#
3479 3480 3481 3482 3483 |
# File 'lib/roebe/custom_methods/module.rb', line 3479 def save_yaml(i) save_into_this_file = 'test.yml' puts 'Now storing data into '+save_into_this_file File.open(save_into_this_file, 'w+') {|f| YAML.dump(i, f)} end |
#say(i = ARGV) ⇒ Object
#
say
Simply a say alias.
Commandline invocation:
rinvoke say ok
#
4147 4148 4149 4150 |
# File 'lib/roebe/custom_methods/module.rb', line 4147 def say(i = ARGV) i = i.join(' ') if i.is_a? Array puts 'You speak: "'+i+'"' end |
#sdl ⇒ Object
#
sdl
#
3562 3563 3564 |
# File 'lib/roebe/custom_methods/module.rb', line 3562 def sdl require 'sdl' end |
#setup_git ⇒ Object Also known as: enable_git
#
setup_git
enable_git
#
2716 2717 2718 2719 2720 2721 2722 |
# File 'lib/roebe/custom_methods/module.rb', line 2716 def setup_git system 'git config --global user.name "Robert A. Heiler"' system 'git config --global user.email [email protected]' system 'git config --global color.ui auto' system 'git config --global core.autocrlf false' system 'git config --global core.filemode false' end |
#sfancy(i) ⇒ Object
#
sfancy
#
3874 3875 3876 |
# File 'lib/roebe/custom_methods/module.rb', line 3874 def sfancy(i) ::Colours.sfancy(i) end |
#show_all_256_colours ⇒ Object
#
show_all_256_colours
Show the 256 colours, from the Colours gem.
#
2532 2533 2534 |
# File 'lib/roebe/custom_methods/module.rb', line 2532 def show_all_256_colours Roebe.show_all_256_colours end |
#show_encoding(i) ⇒ Object
#
show_encoding
Invocation example:
show_encoding "cat"
show_encoding "∂og"
#
482 483 484 |
# File 'lib/roebe/custom_methods/module.rb', line 482 def show_encoding(i) e "'#{i}' (size #{i.size}) is stored in the encoding #{i.encoding.name}" end |
#show_exponential_growth ⇒ Object
#
show_exponential_growth
#
3823 3824 3825 3826 3827 |
# File 'lib/roebe/custom_methods/module.rb', line 3823 def show_exponential_growth 20.times {|iteration_cycle_number| e steelblue(2 ** iteration_cycle_number) } end |
#show_fc_list ⇒ Object
#
show_fc_list
#
3848 3849 3850 3851 |
# File 'lib/roebe/custom_methods/module.rb', line 3848 def show_fc_list _ = 'fc-list : file' esystem _ end |
#show_iso_encoding(i = nil) ⇒ Object
#
show_encoding
This will show the ISO encoding.
#
739 740 741 742 |
# File 'lib/roebe/custom_methods/module.rb', line 739 def show_iso_encoding(i = nil) e "'#{i.inspect} is #{i.encoding.name}" if i e '# Encoding: ISO-8859-1' end |
#show_regex(input_data, regEx) ⇒ Object
#
show_regex
Show regex stuff
#
2119 2120 2121 2122 2123 2124 2125 2126 |
# File 'lib/roebe/custom_methods/module.rb', line 2119 def show_regex(input_data, regEx) e "Regex war #{regEx}",'yelb' if input_data =~ regEx "#{$PREMATCH} MATCH=> #{$MATCH} <=MATCH #{$POSTMATCH}" else 'no match' end end |
#show_registered_binaries ⇒ Object
#
show_registered_binaries
#
1766 1767 1768 1769 |
# File 'lib/roebe/custom_methods/module.rb', line 1766 def show_registered_binaries require 'rbt' RBT.show_registered_binaries end |
#show_roebe_festnetz? ⇒ Boolean
#
show_roebe_festnetz?
#
497 498 499 |
# File 'lib/roebe/custom_methods/module.rb', line 497 def show_roebe_festnetz? e steelblue(roebe_festnetz?) end |
#show_rubylibdir ⇒ Object
#
show_rubylibdir
#
2789 2790 2791 |
# File 'lib/roebe/custom_methods/module.rb', line 2789 def show_rubylibdir e RbConfig::CONFIG['rubylibdir'] end |
#show_the_irb_history ⇒ Object Also known as: history?
#
show_the_irb_history
Note that the alias “history” conflicts with irb, hence it was renamed to history? in January 2024.
#
3655 3656 3657 |
# File 'lib/roebe/custom_methods/module.rb', line 3655 def show_the_irb_history ::Roebe::CustomMethods.show_the_irb_history end |
#show_yaml_syntax ⇒ Object
#
show_yaml_syntax
rinvoke show_yaml_syntax
#
3513 3514 3515 3516 3517 |
# File 'lib/roebe/custom_methods/module.rb', line 3513 def show_yaml_syntax e 'begin' e " YAML::ENGINE.yamler = 'syck' if RUBY_VERSION >= '1.9'".strip e 'rescue NameError; end' end |
#silence_warnings ⇒ Object
#
silence_warnings
rinvoke silence_warnings
#
5138 5139 5140 5141 5142 5143 5144 5145 5146 |
# File 'lib/roebe/custom_methods/module.rb', line 5138 def silence_warnings result = <<-EOF require 'try_syck' EOF result.split(N).each {|line| e line } set_xorg_buffer(result) end |
#singularize(i = ARGV) ⇒ Object
#
singularize
#
3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 |
# File 'lib/roebe/custom_methods/module.rb', line 3778 def singularize( i = ARGV ) require 'extract_pdf_page' require 'pdf_paradise/utility_scripts/pdf_file_n_total_pages.rb' i.each {|file| n_pdf_pages = PdfParadise.return_n_pages(file) _ = PdfParadise.extract_this_page({ pdf_file_to_use: file, start_page: 1, end_page: n_pdf_pages, dont_run_yet: true }) _.run } end |
#size_of_directory(dirname) ⇒ Object
#
size_of_directory
Gives total size of the directory, including all subdirs.
Usage example:
size_of_directory(ENV['MY_DATA']).to_human_readable_bytes
#
1559 1560 1561 1562 1563 1564 |
# File 'lib/roebe/custom_methods/module.rb', line 1559 def size_of_directory(dirname) require 'find' size = 0 Find.find(dirname) { |f| size += File.size(f) } size end |
#snoop_on_keylog(input) ⇒ Object
#
snoop_on_keylog
To use this method, do something like:
snoop_on_keylog "ls -ltR\003emacsHello\012\370rot13-other-window\012\032"
#
1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 |
# File 'lib/roebe/custom_methods/module.rb', line 1985 def snoop_on_keylog(input) input.each_byte { |b| case b when ?\C-c; puts 'Control-C: stopped a process?' when ?\C-z; puts 'Control-Z: suspended a process?' when ?\n; puts 'Newline.' when ?\M-x; puts 'Meta-x: using emacs?' end } end |
#songlist ⇒ Object
#
songlist
#
301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/roebe/custom_methods/module.rb', line 301 def songlist array_that_stores_my_songs = [] tmp_ary = Dir.entries( ENV['SONGS']+'/') tmp_ary.each {|entry| case entry when /.mp3$/, /.ogg$/, /.wav$/ array_that_stores_my_songs << entry end } return array_that_stores_my_songs end |
#sort_by_highest_price ⇒ Object
#
sort_by_highest_price
#
1604 1605 1606 |
# File 'lib/roebe/custom_methods/module.rb', line 1604 def sort_by_highest_price ::Roebe.sort_by_highest_price end |
#sqrt(i = 2) ⇒ Object
#
sqrt
Use this method to calculate the square root of a number.
#
4637 4638 4639 |
# File 'lib/roebe/custom_methods/module.rb', line 4637 def sqrt(i = 2) Math.sqrt(i) end |
#start_apache ⇒ Object
#
start_apache
Start Apache via this method.
#
3157 3158 3159 3160 3161 3162 3163 3164 |
# File 'lib/roebe/custom_methods/module.rb', line 3157 def start_apache if File.directory? '/opt/lampp/' start_lampp else location_of_apachectl = 'apachectl' esystem location_of_apachectl+' start' end # $SYSBIN/apachectl start end |
#start_baldurs_gate2 ⇒ Object
#
start_baldurs_gate2
#
3631 3632 3633 3634 3635 |
# File 'lib/roebe/custom_methods/module.rb', line 3631 def start_baldurs_gate2 esystem ' ruby /home/x/programming/ruby/src/games_paradise/lib/games_paradise/www/baldurs_gate2/baldurs_gate2.sinatra ' end |
#start_lampp ⇒ Object
#
start_lampp
#
2861 2862 2863 |
# File 'lib/roebe/custom_methods/module.rb', line 2861 def start_lampp esystem '/opt/lampp/lampp start' end |
#start_lighttpd ⇒ Object
#
start_lighttpd
#
3245 3246 3247 |
# File 'lib/roebe/custom_methods/module.rb', line 3245 def start_lighttpd self.start_lighttpd end |
#stat_file(i = ARGV) ⇒ Object
#
stat_file
Open a file in the editor with this method.
This is possibly no longer in use.
#
1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 |
# File 'lib/roebe/custom_methods/module.rb', line 1273 def stat_file( i = ARGV ) if i.is_a? Array i.each {|entry| stat_file(entry) } else i = i.to_s.dup if i.include? 'localhost' i.gsub!(/^http\:\/\/localhost\//, ENV['MY_DATA']+'/') end if File.exist? i # e 'Yes file exists here, we can thus open it.' esystem 'stat '+i else # First try a purl. _ = BeautifulUrl::BeautifulUrl.new(i, :replace => true) if _.url_was_found esystem 'stat '+_.url? else opn; e "No file at #{sfile(i)} was found. We conclude "\ "it does not exist." end end end end |
#std_cfdg ⇒ Object
#
std_cfdg
rinvoke std_cfdg
#
4208 4209 4210 4211 4212 |
# File 'lib/roebe/custom_methods/module.rb', line 4208 def std_cfdg require 'x/images/create_cfdg.rb' # bl $RUBY_SRC/IMG/create_cfdg.rb img_dir = '/home/x/data/images' CreateCfdg.new(img_dir) end |
#steop1 ⇒ Object
#
steop1
Ask a question from STEOP1, biology.
#
4907 4908 4909 4910 4911 4912 4913 4914 |
# File 'lib/roebe/custom_methods/module.rb', line 4907 def steop1 require 'studium' unless Object.const_defined? :Studium array = %w( anthro ecology plants zoo syszoo biologie ) topic = array.sample Studium.ask_question(topic) end |
#stop_apache ⇒ Object
#
stop_apache
Stop Apache via this method.
#
2243 2244 2245 2246 2247 2248 2249 |
# File 'lib/roebe/custom_methods/module.rb', line 2243 def stop_apache if File.directory? '/opt/lampp/' stop_lampp else esystem 'apachectl stop' end end |
#stop_lampp ⇒ Object
#
stop_lampp
#
2868 2869 2870 |
# File 'lib/roebe/custom_methods/module.rb', line 2868 def stop_lampp esystem '/opt/lampp/lampp stop' end |
#stop_lighty ⇒ Object Also known as: stop_lighttpd
#
stop_lighty
#
747 748 749 |
# File 'lib/roebe/custom_methods/module.rb', line 747 def stop_lighty ::Roebe.stop_lighty end |
#strip_leading_spaces ⇒ Object
#
strip_leading_spaces
rinvoke strip_leading_spaces
#
153 154 155 156 157 158 159 160 161 162 |
# File 'lib/roebe/custom_methods/module.rb', line 153 def strip_leading_spaces file = ENV['LINUX_YAML']+'/cd_aliases.yml' _ = File.readlines(file) to = ENV['DEPOT']+'/j/'+File.basename(file) puts 'Storing data into '+to+' now.' _.each { |line| what = line.strip append_what_to(what, to) } end |
#strip_lowercase ⇒ Object
#
strip_lowercase
Used in rinvoke.
#
2144 2145 2146 |
# File 'lib/roebe/custom_methods/module.rb', line 2144 def strip_lowercase e STDIN.read.tr('_',' ') end |
#studium ⇒ Object
#
studium
#
3598 3599 3600 |
# File 'lib/roebe/custom_methods/module.rb', line 3598 def studium require 'studium' end |
#stundenplan? ⇒ Boolean
#
stundenplan?
Output the stundenplan.yml file.
#
1358 1359 1360 1361 |
# File 'lib/roebe/custom_methods/module.rb', line 1358 def stundenplan? _ = ENV['SCIENCE']+'/studium/yaml/stundenplan.yml' File.readlines(_).each {|x| e ' '+x } end |
#switch_to_psych ⇒ Object Also known as: psych
#
switch_to_psych
Switch to use the psych-engine here.
#
3470 3471 3472 |
# File 'lib/roebe/custom_methods/module.rb', line 3470 def switch_to_psych YAML::ENGINE.yamler = 'psych' end |
#symlink(existing_name, new_name, be_verbose = true) ⇒ Object Also known as: symlink_from_to
#
symlink (symlink tag, symlink to tag)
Set a symlink via this method.
#
1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 |
# File 'lib/roebe/custom_methods/module.rb', line 1066 def symlink( existing_name, new_name, be_verbose = true ) e 'Symlinking '+existing_name+' to '+new_name+'.' if File.exist? new_name if be_verbose e 'Can not symlink because '+new_name+' already exists.' end else File.symlink(existing_name, new_name) end end |
#symmetrical_renaming_of_files_in_this_directory(i = return_pwd) ⇒ Object
#
symmetrical_renaming_of_files_in_this_directory
This ad-hoc method will just rename some files in the target directory given.
#
5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 |
# File 'lib/roebe/custom_methods/module.rb', line 5185 def symmetrical_renaming_of_files_in_this_directory( i = return_pwd ) i << '/' unless i.end_with? '/' # base_dir = i.dup # Keep a copy for reference. Not needed. all_files = Dir[i+'*'].select {|entry| !File.directory?(entry) }.sort all_files.each {|file| e 'Now working on file `'+sfile(file)+'`.' extname = File.extname(file) new_name = file.gsub(/#{extname}$/, extname.downcase) mv(file, new_name) unless file == new_name # Past this point, things are downcased. file = new_name # Assign a new name. basename = File.basename(file) if basename.index('.') == 1 # This means that we need to pad. right_part = basename[(basename.index('.')+1)..-1] counter = basename[0..basename.index('.')] counter = counter.rjust(3, '0') # Now it was corrected. new_filename = counter+right_part mv(file, new_filename) # else # else we don't have to do anything. end } end |
#sys(input = 'ls') ⇒ Object
#
sys
sys tag, wrapper to system() I dont think this should still be used.
#
889 890 891 |
# File 'lib/roebe/custom_methods/module.rb', line 889 def sys(input = 'ls') system(input) end |
#sysbg(inp) ⇒ Object
#
sysbg
#
4573 4574 4575 |
# File 'lib/roebe/custom_methods/module.rb', line 4573 def sysbg(inp) system("#{inp} &") end |
#system_with_pid(*cmd) {|pid| ... } ⇒ Object
#
system_with_pid
This is useful to get the pid of a process. pid tag.
system_with_pid("mplayer Strack_TaiChi_JetLi_FinalBattle.mp3") { |pid| puts "Pid is #{pid}" }
Use system_with_pid if you want to get the pid.
#
1188 1189 1190 1191 1192 1193 1194 1195 1196 |
# File 'lib/roebe/custom_methods/module.rb', line 1188 def system_with_pid(*cmd) pid = fork { exec(*cmd) exit! 127 } yield pid if block_given? Process.waitpid(pid) return $CHILD_STATUS end |
#tabbed_mean(i = ' 1.240 1.490 0.751 0.793 1.420 1.400 1.110 1.260 1.100 0.973 1.420 1.420 0.669 1.080 1.020 1.430 0.986 1.490 1.340 0.804 1.330 1.400 1.170 1.400 1.190 1.620 1.380 1.160 1.320 0.780 1.560 1.310 0.745 1.200 1.070 1.260 ') ⇒ Object
#
tabbed_mean
This is similar to avg(), but we will parse the input in a different way.
#
2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 |
# File 'lib/roebe/custom_methods/module.rb', line 2345 def tabbed_mean(i = ' 1.240 1.490 0.751 0.793 1.420 1.400 1.110 1.260 1.100 0.973 1.420 1.420 0.669 1.080 1.020 1.430 0.986 1.490 1.340 0.804 1.330 1.400 1.170 1.400 1.190 1.620 1.380 1.160 1.320 0.780 1.560 1.310 0.745 1.200 1.070 1.260 ' ) _max_length_of_the_line = 0 split_per_line = i.split("\n").reject {|line| line.strip.empty? } n_columns = split_per_line.first.split(' ').size _max_length_of_the_line = split_per_line.first.size array_results = Array.new(n_columns, []) split_per_line.each_with_index {|this_line, index| splitted = this_line.split(' ').map(&:strip).map(&:to_f) if splitted.size == n_columns # in this case we can just add it array_results[index] = splitted elsif splitted.size > n_columns # in this case we have to pad # Determine the offset e tomato(this_line) e 'TODO: This is incomplete.' end } end |
#terminal? ⇒ Boolean
#
terminal?
#
4596 4597 4598 |
# File 'lib/roebe/custom_methods/module.rb', line 4596 def terminal? Roebe::Terminal.verbose_terminal? end |
#test1 ⇒ Object
#
test1
#
2957 2958 2959 2960 2961 2962 |
# File 'lib/roebe/custom_methods/module.rb', line 2957 def test1 require 'multimedia_paradise' require 'multimedia_paradise/requires/require_the_sinatra_components.rb' e 'http://localhost:5580/228_Apocalypto.mp4' MultimediaParadise.start_sinatra end |
#test_genbank ⇒ Object
#
test_genbank
Just play with some genbank stuff.
#
457 458 459 460 461 462 |
# File 'lib/roebe/custom_methods/module.rb', line 457 def test_genbank require 'bioroebe' _ = Bioroebe.parse_fasta '/Depot/Temp/bioroebe/sequence.fasta' id = _.sequence_id? Bioroebe::GenbankFlatFileFormatGenerator.new(_.sequence) {{ sequence_id: id }} end |
#test_openssl ⇒ Object
#
test_openssl
#
2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 |
# File 'lib/roebe/custom_methods/module.rb', line 2967 def test_openssl require 'socket' require 'openssl' server_name = 'irc.freenode.net' irc = TCPSocket.open(server_name, '6667') ssl_context = OpenSSL::SSL::SSLContext.new ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE irc = OpenSSL::SSL::SSLSocket.new(irc, ssl_context) # Replace it here. irc.sync = true irc.connect irc.puts 'NICK shevy_test' # 'NICK Pyra' irc.puts "USER shevy_test #{server_name} #{which_channel} :#{@name}" # 'USER Pyra Pyra Pyra :Pyra IRC Client' end |
#the_pid? ⇒ Boolean
#
the_pid?
The process ID.
#
1807 1808 1809 |
# File 'lib/roebe/custom_methods/module.rb', line 1807 def the_pid? e Process.pid.to_s end |
#this_is_a_test ⇒ Object
#
this_is_a_test
#
3270 3271 3272 |
# File 'lib/roebe/custom_methods/module.rb', line 3270 def this_is_a_test e 'This is a test.' end |
#time? ⇒ Boolean Also known as: rubytime?, rubytime
#
time?
#
1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 |
# File 'lib/roebe/custom_methods/module.rb', line 1664 def time? e 'Stunde / Minute / Sekunde' e e 'def return_hours_minutes_seconds' e " Time.now.strftime('%H:%M:%S') # => '05:44:39'" e 'end' e e 'Tag / Monat / Jahr' e e 'def return_day_month_year' e " Time.now.strftime('%d.%m.%Y') # => '#{Time.now.strftime('%d.%m.%Y')}" e 'end' e e "Time.now.strftime('%A') # => '"+Time.now.strftime('%A').to_s+"'" e end |
#tinyurl(url_of = 'http://derstandard.at/?url=/?id=3171411') ⇒ Object
#
tinyurl
Gives you the tiny url version of an URL.
#
4391 4392 4393 4394 |
# File 'lib/roebe/custom_methods/module.rb', line 4391 def tinyurl(url_of = 'http://derstandard.at/?url=/?id=3171411') require 'shorturl' e ShortURL.shorten(url_of, :tinyurl) end |
#to_1000_ECTS ⇒ Object Also known as: to1000
#
to_1000_ECTS
#
839 840 841 842 |
# File 'lib/roebe/custom_methods/module.rb', line 839 def to_1000_ECTS require 'studium/toplevel_methods/toplevel_methods.rb' Studium.to_perfection end |
#to_ascii(this_image = ARGV.first) ⇒ Object
#
to_ascii
Convert an image to ascii.
rinvoke to_ascii /home/x/data/IMG/RPG/ADOPTION/TRIBE_MEDIUM.jpg
#
1758 1759 1760 1761 |
# File 'lib/roebe/custom_methods/module.rb', line 1758 def to_ascii(this_image = ARGV.first) require 'x/std/std_drawing.rb' StdDrawing.jp2a(this_image) end |
#to_boolean(value) ⇒ Object
#
to_boolean
Returns whether the value matches a true value, such as “yes”, “true”, “ok”, pass or “on”.
#
4402 4403 4404 |
# File 'lib/roebe/custom_methods/module.rb', line 4402 def to_boolean(value) %w( yes true ok pass on ).include?(value.to_s.downcase) end |
#to_current(this_dir = ARGV.first) ⇒ Object
#
to_current
This method will make use of the class RBT::SymlinkFromToCurrent.
Usage examples:
rinvoke to_current 4.2.3
tocurrent 4.2.3
#
1710 1711 1712 |
# File 'lib/roebe/custom_methods/module.rb', line 1710 def to_current(this_dir = ARGV.first) ::Roebe.to_current(this_dir) end |
#to_frequency(i = nil) ⇒ Object Also known as: tohash
#
to_frequency
This method will perform an opinionated conversion towards a Hash. I do NOT recommend to keep calling this to_hash, though.
Invocation example:
to_frequency([1,2,4,5,4,7,8,8,8,8]) # => {1=>1, 2=>1, 4=>2, 5=>1, 7=>1, 8=>4}
#
1023 1024 1025 1026 1027 1028 1029 1030 1031 |
# File 'lib/roebe/custom_methods/module.rb', line 1023 def to_frequency(i = nil) if i if i.is_a? Array hash = Hash.new(0) i.each {|key| hash[key] += 1} return hash end end end |
#to_mp3(i = ARGV) ⇒ Object
#
to_mp3
#
4589 4590 4591 |
# File 'lib/roebe/custom_methods/module.rb', line 4589 def to_mp3(i = ARGV) ::Roebe.to_mp3(i) end |
#to_mp4(i = ARGV) ⇒ Object
#
to_mp4
#
3045 3046 3047 3048 3049 |
# File 'lib/roebe/custom_methods/module.rb', line 3045 def to_mp4(i = ARGV) i = i.first if i.is_a? Array _ = 'ffmpeg -i '+i+' '+i+'.mp4' Esystem.esystem(_) end |
#to_mpg(file = ARGV.first) ⇒ Object
#
to_mpg
Convert to .mpg format.
#
2907 2908 2909 2910 2911 2912 |
# File 'lib/roebe/custom_methods/module.rb', line 2907 def to_mpg(file = ARGV.first) file = file.dup _ = 'ffmpeg -i '+file+' -sameq '+file+'.mpg ' e _ system _ end |
#to_utf(i) ⇒ Object
#
to_utf
This method will convert the given String into UTF.
Usage example:
x = 'fragen über computer'; var = to_utf(x); pp var.encoding
#
4424 4425 4426 4427 4428 4429 4430 4431 |
# File 'lib/roebe/custom_methods/module.rb', line 4424 def to_utf(i) if i.is_a? String return i.encode('UTF-8') else e 'Please supply a String to this method.' nil end end |
#to_webm(i = ARGV) ⇒ Object
#
to_webm
#
616 617 618 619 620 621 622 623 624 625 |
# File 'lib/roebe/custom_methods/module.rb', line 616 def to_webm(i = ARGV) unless Object.const_defined? :MultimediaParadise require 'multimedia_paradise/include_multimedia_conversions' end if i.is_a? Array i.each {|entry| to_webm(entry) } else MultimediaConversions.general_format_conversion(i, :to_webm) end end |
#today? ⇒ Boolean
#
today?
#
4229 4230 4231 |
# File 'lib/roebe/custom_methods/module.rb', line 4229 def today? ::Time.now.strftime('%d.%m.%Y') end |
#try_to_enable_the_expanded_cd_aliases ⇒ Object
#
try_to_enable_the_expanded_cd_aliases
#
3363 3364 3365 3366 |
# File 'lib/roebe/custom_methods/module.rb', line 3363 def require 'roebe/toplevel_methods/try_to_enable_the_expanded_cd_aliases.rb' ::Roebe. end |
#uid(i = 124) ⇒ Object
#
uid
More a wrapper around euid.
#
1094 1095 1096 |
# File 'lib/roebe/custom_methods/module.rb', line 1094 def uid(i = 124) Process.euid = i end |
#undone ⇒ Object
#
undone
#
175 176 177 |
# File 'lib/roebe/custom_methods/module.rb', line 175 def undone Undone.new('*') end |
#unicode(i = '271B') ⇒ Object
#
unicode
Some usage examples:
unicode 'u2713' # => ✓
unicode '271B' # => ✛
unicode "2591" # => ░
unicode "2598" # => ▘
#
5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 |
# File 'lib/roebe/custom_methods/module.rb', line 5492 def unicode( i = '271B' ) if i.is_a? Array i = i.join(' ').strip end i = i.dup if i.start_with? 'u' i[0, 1] = '' end _ = '\u'.dup _ << i.to_s puts _.gsub(/\\u[\da-f]{4}/i) { |entry| [entry[-4..-1].to_i(16)].pack('U') } end |
#uniwien? ⇒ Boolean
#
uniwien?
#
4005 4006 4007 4008 4009 |
# File 'lib/roebe/custom_methods/module.rb', line 4005 def uniwien? e BeautifulUrl[:uniwien] e BeautifulUrl[:unimail] Passwords.password_for :uniwien end |
#update(install_how = :both) ⇒ Object Also known as: allruby, ruby_update
#
update (iruby tag, update tag)
See the delegated method for documentation.
#
5425 5426 5427 |
# File 'lib/roebe/custom_methods/module.rb', line 5425 def update(install_how = :both) # rupdate ::Roebe.update(install_how) end |
#uri ⇒ Object
#
uri
#
3569 3570 3571 |
# File 'lib/roebe/custom_methods/module.rb', line 3569 def uri require 'open-uri' end |
#use(i = ARGV) ⇒ Object
#
use
Use this method to switch between ruby versions. Right now we ignore the input.
#
3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 |
# File 'lib/roebe/custom_methods/module.rb', line 3107 def use(i = ARGV) current_ruby_version = RUBY_VERSION possible_targets = Dir[ ENV['MY_PROGRAMS']+'/Ruby/*/'].reject {|x| x !~ /\d+/ } possible_targets.reject! {|x| x =~ /#{current_ruby_version}/ } match = possible_targets.first # should include our target. if match require 'rbt/symlink_program.rb' puts 'Trying to match towards '+match+' now.' RBT::SymlinkFromToCurrent.new(match) end end |
#use_firefox_for_kde_konsole ⇒ Object
#
use_firefox_for_kde_konsole
#
138 139 140 141 142 143 144 145 146 |
# File 'lib/roebe/custom_methods/module.rb', line 138 def use_firefox_for_kde_konsole target_file = '/root/.kde/share/config/kdeglobals' into = target_file what = ' [General] BrowserApplication[$e]=!firefox ' append_what_into(what, into) unless File.read(into).include? 'firefox' end |
#utf? ⇒ Boolean
#
utf?
Return the main UTF-8 / Unicode encoding.
#
5514 5515 5516 5517 5518 5519 |
# File 'lib/roebe/custom_methods/module.rb', line 5514 def utf? e '#<Encoding:UTF-8>' e e '#!/usr/bin/ruby -w' e '# Encoding: UTF-8' end |
#valid_ISBN?(i = '9783423348478') ⇒ Boolean
#
valid_ISBN? (ISBN tag, isbn tag)
This method will check whether the given input is a valid ISBN number or whether it is not.
A valid ISBN number contains 13 numbers.
Usage example:
valid_ISBN?('9783423348478') # => true
valid_ISBN?('9783423348479') # => false
#
4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 |
# File 'lib/roebe/custom_methods/module.rb', line 4056 def valid_ISBN?( i = '9783423348478' ) z = i.split(//).map(&:to_i) # ======================================================================= # # The formula is: # # z1 + z3 + z5 + z7 + z9 + z11 + z13 + 3 * (z2 + z4 + z6 + z8 + z10 + z12) mod 10 == 0 # # ======================================================================= # z1 = z[0] z2 = z[1] z3 = z[2] z4 = z[3] z5 = z[4] z6 = z[5] z7 = z[6] z8 = z[7] z9 = z[8] z10 = z[9] z11 = z[10] z12 = z[11] z13 = z[12] result = z1 + z3 + z5 + z7 + z9 + z11 + z13 + 3 * (z2 + z4 + z6 + z8 + z10 + z12) result = result % 10 result == 0 end |
#verbose_number(number) ⇒ Object
#
verbose_number
verbose_number 11
#
1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 |
# File 'lib/roebe/custom_methods/module.rb', line 1944 def verbose_number(number) case number.to_i when 1 'one' when 2 'two' when 3 'three' when 4 'four' when 5 'five' when 6 'six' when 7 'seven' when 8 'eight' when 9 'nine' when 10 'ten' when 11 'eleven' when 12 'twelve' when 13 'thirteen' when 14 'fourteen' when 15 'fifteen' end end |
#verbose_truth(i) ⇒ Object Also known as: vt, yes_no
#
verbose_truth(true)
VERBOSE ENGLISH: ANSWER YES OR NO.
Note that this will usually also return a trailing ‘.’ character.
Invocation examples:
x = 'true'; verbose_truth x
verbose_truth(true)
verbose_truth @traditional
#
3131 3132 3133 3134 |
# File 'lib/roebe/custom_methods/module.rb', line 3131 def verbose_truth(i) require 'verbose_truth' VerboseTruth.verbose_truth(i) end |
#view_slackware_packages(also_modify_the_cookbook_files = true) ⇒ Object
#
view_slackware_packages
This method will just tell us the short name of each Slackware package.
#
4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 |
# File 'lib/roebe/custom_methods/module.rb', line 4260 def view_slackware_packages( also_modify_the_cookbook_files = true ) if also_modify_the_cookbook_files e 'We will also modify the individual cookbook files.' e 'If you do not want to do this, input "n" next (for no, without the quotes)' _ = $stdin.gets.chomp if _.start_with? 'n' also_modify_the_cookbook_files = false end end begin require 'rbt/cookbooks/sanitize_cookbook_dataset/sanitize_cookbook_dataset.rb' rescue LoadError; end require 'program_information' require 'cat' base_dir = '/var/log/packages/' individual_cookbooks_directory = RUBY_SRC_DIR+'rbt/lib/rbt/yaml/individual_cookbooks/' cd base_dir files = Dir['*'].sort # Keep them sorted. files.each_with_index {|file, index| program_information = ProgramInformation::ProgramInformation.new(file) program_name = program_information.name? # ======================================================================= # # Only report for matches that we have registered. # ======================================================================= # if RBT.does_include? program_name.downcase _ = RBT::Cookbooks::SanitizeCookbookDataset.new(program_name.downcase) if _.short_description?.to_s.strip.empty? use_this_regex = /#{program_name}: \w+ \((.+)\)/ # See: http://rubular.com/r/8P2agw9Hv2 content = File.read(file) content =~ use_this_regex unless $1.to_s.empty? index += 1 opne "#{rev}Working on the file `#{sfile(file)}"\ "#{rev}` (Assumed program name: `"+ simp(program_name)+rev+ '`, entry number: '+sfancy(index.to_s)+ rev+')' cliner e ' === '+program_name.downcase+'.yml' short_desc = ' short_description: '+$1.to_s.dup e short_desc cliner if also_modify_the_cookbook_files into = individual_cookbooks_directory+program_name.downcase+'.yml' what = File.read(into)+N+short_desc write_what_into(what, into) end end end end } end |
#wav_to_opus(i = ARGV) ⇒ Object
#
wav_to_opus
#
203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/roebe/custom_methods/module.rb', line 203 def wav_to_opus( i = ARGV ) unless Object.const_defined? :MultimediaParadise require 'multimedia_paradise' end if i.is_a? Array i.each {|entry| wav_to_opus(entry) } else MultimediaParadise::MultimediaConversions.wav_to_opus(i) end end |
#webrick ⇒ Object Also known as: wrick, start_my_webrick, start_webrick
#
wrick
First argument specifies which port to use.
Usage example:
webrick 8000
#
3926 3927 3928 3929 3930 3931 3932 3933 3934 |
# File 'lib/roebe/custom_methods/module.rb', line 3926 def webrick ( _port = ARGV.first, document_root_to_use = '/home/x/', # ENV['MY_DATA'], config = {} ) require 'roebe/toplevel_methods/webrick.rb' ::Roebe.start_webrick 8000 end |
#week? ⇒ Boolean
#
week?
#
3771 3772 3773 |
# File 'lib/roebe/custom_methods/module.rb', line 3771 def week? e Cat[BeautifulUrl['week']] end |
#welcome ⇒ Object
#
welcome
#
3583 3584 3585 |
# File 'lib/roebe/custom_methods/module.rb', line 3583 def welcome e 'Welcome to IRB!' end |
#which_platform? ⇒ Boolean
#
which_platform?
What is your platform? puts which_platform?
#
2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 |
# File 'lib/roebe/custom_methods/module.rb', line 2095 def which_platform? $RUBY_PLATFORM ||= # wird erstellt case RUBY_PLATFORM.downcase # when /linux/i, /freebsd/i, /bsd/i, /solaris/i, # /hpux/i, /powerpc-darwin/i # Old above, new below. when /linux|bsd|solaris|hpux|powerpc-darwin/ :unix when /mswin32|mingw32|bccwin32/ :windows when /cygwin/ :cygwin when /java/ :java else :other end end |
#windows_md5 ⇒ Object
#
windows_md5
Windows Functions windows tag win tag
#
874 875 876 877 878 879 880 881 |
# File 'lib/roebe/custom_methods/module.rb', line 874 def windows_md5 require 'md5' if ARGV.first == '-n' puts MD5.new(File.readlines(ARGV.pop, 'r').join.gsub(/\r\n?/, "\n")).hexdigest else puts MD5.new(File.open(ARGV.pop, 'rb').read).hexdigest end end |
#with_captured_stdout ⇒ Object
#
with_captured_stdout
#
2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 |
# File 'lib/roebe/custom_methods/module.rb', line 2018 def with_captured_stdout begin old_stdout = $stdout $stdout = StringIO.new('','w') yield $stdout.string ensure $stdout = old_stdout # Restore the old stdout again. end end |
#wochentag?(i = ARGV.first) ⇒ Boolean
1657 1658 1659 |
# File 'lib/roebe/custom_methods/module.rb', line 1657 def wochentag?(i = ARGV.first) ::Roebe.wochentag? end |
#wrap(i = '/FILE') ⇒ Object
#
wrap
Wraps to wrap_at.
#
2658 2659 2660 2661 |
# File 'lib/roebe/custom_methods/module.rb', line 2658 def wrap(i = '/FILE') x = File.readlines(i).join(' ') e x.wrap_at(60).remove(' ') end |
#write_this_into_file(c, l = 'STORE_INTO_THIS_FILE', mode = 'w+') ⇒ Object Also known as: save
#
write_this_into_file
Just a wrapper to the above method, but with w+ flag.
#
2133 2134 2135 2136 2137 |
# File 'lib/roebe/custom_methods/module.rb', line 2133 def write_this_into_file( c, l = 'STORE_INTO_THIS_FILE', mode = 'w+' ) save_what_to(c, l, mode) end |
#wurzel(i) ⇒ Object
#
wurzel
#
5238 5239 5240 |
# File 'lib/roebe/custom_methods/module.rb', line 5238 def wurzel(i) Math.sqrt(i) end |
#x1 ⇒ Object
#
x
#
1163 1164 1165 |
# File 'lib/roebe/custom_methods/module.rb', line 1163 def x1 bio; puts Bioroebe.new.to_dna('actgggcgagagklklklklk') end |
#xchat ⇒ Object Also known as: chat
#
xchat
rinvoke xchat Will generate a new servlist.conf file.
#
3194 3195 3196 3197 |
# File 'lib/roebe/custom_methods/module.rb', line 3194 def xchat require 'irc_channels' IrcChannels.new # bl $RSRC/irc_channels/lib/irc_channels/irc_channels.rb end |
#xfce_autostart ⇒ Object
#
xfce_autostart
#
5212 5213 5214 5215 |
# File 'lib/roebe/custom_methods/module.rb', line 5212 def xfce_autostart require 'autostart' Autostart.new(:xfce) # bl $RSRC/autostart/lib/autostart/autostart.rb end |
#xml ⇒ Object
#
xml
#
945 946 947 |
# File 'lib/roebe/custom_methods/module.rb', line 945 def xml require 'rexml/document' end |
#yam ⇒ Object
#
yam
#
1576 1577 1578 |
# File 'lib/roebe/custom_methods/module.rb', line 1576 def yam require 'yaml' end |
#yaml(this_file) ⇒ Object
#
yaml
#
3624 3625 3626 |
# File 'lib/roebe/custom_methods/module.rb', line 3624 def yaml(this_file) YAML.load_file(this_file) end |