Server name/IP converter
#!/usr/bin/perl -w use strict; use Socket; my $arg = shift; if ($arg =~ /^(\d+\.){3}\d+$/) { print scalar gethostbyaddr(inet_aton($arg), AF_INET), "\n" } else { printf "%vd\n", scalar gethostbyname $arg }
11303 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
#!/usr/bin/perl -w use strict; use Socket; my $arg = shift; if ($arg =~ /^(\d+\.){3}\d+$/) { print scalar gethostbyaddr(inet_aton($arg), AF_INET), "\n" } else { printf "%vd\n", scalar gethostbyname $arg }
machine-id: does [read dns://]
lookupd -flushcache
find . | grep -e "zone" | xargs perl -pi -e 's/allow-transfer {.+?}\;//'
#!/usr/bin/env ruby require 'optparse' require 'net/http' require 'cgi' class EveryDnsUpdater attr_accessor :user, :pass attr_reader :ip, :code, :body def params @params ||= {"ver" => "0.1"} end def host "dyn.everydns.net" end def query "/index.php?" + params.collect{ |k,v| "#{k}=#{CGI.escape(v)}"}.join('&') end def parse(body) @body = body @code = @body.scan(/Exit Code: (\d+)/i).to_s.to_i @ip = @body.scan(/IP now: ([\d\.]+)/).to_s end def run Net::HTTP.start(host) do |http| req = Net::HTTP::Get.new(query) req.basic_auth(user, pass) response = http.request(req) case response when Net::HTTPSuccess parse(response.body) return @code else return response.code end end end end opts = OptionParser.new updater = EveryDnsUpdater.new opts.banner = "Usage: everydns [options]" opts.separator "" opts.on("-u", "--user=USER", "User name") { |str| updater.user = str } opts.on("-p", "--pass=PASS", "Password") { |str| updater.pass = str } opts.on("-d", "--domain=DOMAIN", "Domain name you wish to update") { |str| updater.params["domain"] = str } opts.on("-a", "--address=[IP]", "IP address you want to supply") { |str| updater.params["ip"] = str } opts.on_tail("-h", "--help") { puts opts; exit } opts.parse(ARGV) if ARGV.empty? or updater.user.nil? or updater.pass.nil? or updater.params["domain"].nil? puts opts exit end if updater.run == 0 puts "IP address set to #{updater.ip} successfully..." else puts "Not successful..." puts updater.body end