反正就是一整個好玩!!!(  ̄ c ̄)y▂ξ

backup config files by tftp

#!/usr/bin/expect -f
set timeout 60
spawn ssh admin@fgt-ipaddress
expect “password: $”
set send_slow {1 0.05}
send -s “password\r”
send_user “password\r”
send -s ” config global\n”
send -s “execute backup full-config tftp filename.txt tftp-ipaddress\n”
send -s “exit\n”
interact

http://www.firewall1.nu/?p=28

http://phpsrv.nutn.edu.tw/~silent/archives/113

http://plog.tcc.edu.tw/post/128/2034

 

檔案上傳至linux tftp時,目錄必須有此檔名存在,並且可寫入。

igogo 發表在 痞客邦 留言(0) 人氣()

wscript 中inputbox 並不能隱藏密碼,必須使用ScriptPW,但是 windows home edition版本並沒有相關的dll檔。除了copy scriptpw.dll 再執行註冊的方法外。參考

另一簡單方法就是跑html+vbscript or javascript

igogo 發表在 痞客邦 留言(0) 人氣()

cron stops in the middle of the script

http://www.linuxquestions.org/questions/linux-newbie-8/cron-stops-in-the-middle-of-the-script-325487/

 

put...

>> /dev/null 2>&1

...at the end of each crontab listing.

igogo 發表在 痞客邦 留言(0) 人氣()

與指令paste的功用相同

#!/usr/bin/ruby

files = Array.new
files = ["a.txt","b.txt","c.txt"]

tmp = Array.new
raw_data = Array.new

for i in 0..files.size-1
  File.open(files[i]) do |txt|

    while line=txt.gets
      tmp << line.chomp
    end
    raw_data << tmp.join(',').split(',')
    tmp.clear
  end
end

raw_data.transpose

for i in 0..raw_data.transpose.size-1
  puts raw_data.transpose[i].join("\t")
end





igogo 發表在 痞客邦 留言(0) 人氣()

以輸入參數的方式帶入

Set args = WScript.Arguments
WScript.Echo (args.Item(0) & args.Item(1)) 

 檢查是否有輸入參數

if WScript.Arguments.Count = 0 then 
    WScript.Echo "Missing parameters" 
end if 

 

http://stackoverflow.com/questions/2806713/can-i-pass-an-argument-to-a-vbscript-vbs-file-launched-with-cscript

http://technet.microsoft.com/en-us/library/ee156604.aspx

igogo 發表在 痞客邦 留言(0) 人氣()

get mms file -> mp3


#!/usr/bin/ruby -Kw
require 'fileutils'
#mms_stream = ARGV[0]
class Mms 

    def self.FetchMms(mms_stream)
    wav_file=File.basename("#{mms_stream}").gsub(/.wma/,".wav")
            #mms://url

            #存成wav檔
  system("/usr/bin/mplayer -ao pcm:file=#{wav_file} #{mms_stream}")
    mp3_file=wav_file.gsub(/.wav/,".mp3")
            #puts mp3_file
    #將wav轉成mp3檔
    system("/usr/bin/lame -b 42 #{wav_file} #{mp3_file}")
    FileUtils.rm "#{wav_file}"
  end
end

if ARGV[0].nil?
  puts "usage: mms url or file"
else
  Mms.FetchMms(ARGV[0])
end

 

use ffmpeg

ext = ".wma"
Dir.glob("*#{ext}").each {|f| m = f.gsub(ext, '.mp3'); `ffmpeg -i '#{f}' -ab 192k -ac 2 -ar 44100 '#{m}'` }

igogo 發表在 痞客邦 留言(0) 人氣()

DSC_0568

 

DSC_0570

DSC_0565

DSC_0554

igogo 發表在 痞客邦 留言(0) 人氣()

這個問題實在很有趣,以前很少把自己的硬盤塞到滿過

想不到現在為了我的數據,竟然可以塞到20G,只好向另一顆500G求救 Orz

原來ftpd在使用chroot後,就不允許symbolic links

詳解

http://pureftpd.sourceforge.net/FAQ

Making a symbolic link won't work, because when you are chrooted, it means
that everything outside a base directory (your user's home directory) won't
be reachable, even though a symbolic link.

But all modern operating systems can mount local directories to several
locations. To have an exact duplicate of your /var/incoming directory
available in /home/john/incoming and /home/joe/incoming, use one of these
commands:

 

* Linux   : mount --bind /var/incoming /home/john/incoming
mount --bind /var/incoming /home/joe/incoming
* BSD     : mount_null /var/incoming /home/john/incoming
mount_null /var/incoming /home/joe/incoming


 

igogo 發表在 痞客邦 留言(0) 人氣()