This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $load = [] | |
| File.foreach 'LOAD.out' do |line| | |
| if line =~/^\* LOAD:\s*table(.*)$/ | |
| $load << $cc if $cc | |
| tbs = $1.gsub /\s/,'' | |
| $cc=[tbs, -1, -1, -1, -1, -1] | |
| elsif line =~ /Rows read:(.*)$/ | |
| $cc[1] = $1.to_i | |
| elsif line =~ /Loaded:(.*)$/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby -w | |
| # OSX 创建内存盘 | |
| puts '================================================================' | |
| cmd="hdiutil attach -nomount ram://1048576" | |
| puts ">>> #{cmd}" | |
| new_disk=`#{cmd}` | |
| new_disk.strip! | |
| puts new_disk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'zlib' | |
| def show_lba0(rawdata) | |
| puts "LBA0 ( MBR or PMBR )" | |
| mbr = rawdata[446...512] | |
| if mbr.size!=66 || mbr[-2..-1].unpack('CC') != [0x55, 0xaa] | |
| puts "Not valid MRB part data" | |
| puts | |
| return | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # proc, lambda difference | |
| # Proc.new/proc --> not check parameter, return outside method | |
| # lambda/-> --> check parameter, return just return lambda | |
| p '------------------' | |
| def test_1 | |
| p 'begin' | |
| p1 = Proc.new do |x,y| p [x,y]; return end | |
| p1.call | |
| p 'end' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def oo(cylinder, sector) | |
| sector *= 512 | |
| aa=<<-EOS | |
| echo "cylinder: #{cylinder}" | |
| losetup -o #{sector} /dev/loop1 /dev/sdb3 | |
| if [ $? -eq 0 ] ; then | |
| mount /dev/loop1 /tmp/11 2>/dev/null | |
| if [ $? -eq 0 ] ; then | |
| echo "offset #{sector} byte find a file system!!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Option Explicit | |
| Function GetFolder(strPath As String) As String | |
| Dim fldr As FileDialog | |
| Dim sItem As String | |
| Set fldr = Application.FileDialog(msoFileDialogFolderPicker) | |
| With fldr | |
| .Title = "Select a Folder" | |
| .AllowMultiSelect = False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### included | |
| upstream app1.com { | |
| server 127.0.0.1:3001; | |
| # server 127.0.0.1:3002; | |
| # server 127.0.0.1:3003; | |
| # server 127.0.0.1:3004; | |
| # server 127.0.0.1:3005; | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'formula' | |
| class Ruby < Formula | |
| homepage 'http://www.ruby-lang.org/en/' | |
| url 'http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.0-preview1.tar.bz2' | |
| sha256 '860b90d28b214393fd9d77ac2ad65b384d8249cd59b658c668cf0c7bad1db341' | |
| option :universal | |
| option 'with-suffix', 'Suffix commands with "20"' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class C1 | |
| def a;end | |
| private | |
| def e;end | |
| end | |
| C1.public_methods false #=> [:allocate, :new, :superclass] | |
| c1=C1.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'tk' | |
| File.open '/tmp/tk1.txt', 'w' do |f| | |
| Object.constants.grep( /^Tk/).sort.each do |x| | |
| n = Object.const_get x rescue x | |
| f.puts "#{x} \t#{n.to_s} \t#{n.__id__}" | |
| end | |
| end | |
| File.open '/tmp/ttk1.txt', 'w' do |f| |