Useful tool for sniffing DHCP Server on specified Interface
python dhcpd_detector.py [--config <filename>.cfg]
# -*- coding: utf-8 -*- | |
require 'nokogiri' | |
require 'open-uri' | |
require 'pry' | |
doc = Nokogiri::HTML(open('http://resys.51qiangzuo.com/')) | |
a = doc.xpath('//table[@class="attendee_list"]/tr/td').grep(/公司/).map{|a| a.text.gsub(/公司:\s*/,"")} | |
num = {} | |
list = { | |
"土豆" => "土豆网", |
require 'optparse' | |
options = {} | |
OptionParser.new do |opts| | |
opts.banner = "Usage: #{$0} -r JID -m content" | |
opts.on('-m', '--message MESSAGE','Message to be sent') do |m| | |
options[:message] = m | |
end |
plugins: | |
sitemap_generator: # all optional | |
file_name: sitemap.xml | |
exclude_id: | |
- search.html | |
- pages.html | |
change_frequency_custom_name: changefreq | |
priority_custom_variable_name: priority |
# -*- encoding : utf-8 -*- | |
## | |
# Apple 类, 只有一个属性, 叫做重量 (@weight) | |
# Apple 还有一个类属性, 叫做苹果数量 (@@count) | |
class Apple | |
@@count = 0 | |
## | |
# 我是类方法, 直接在 Apple 上面调用我就行了 | |
def self.count |
#!/usr/bin/env python | |
# coding: UTF-8 | |
import re | |
import time | |
DHCPD_LEASES_FILE="/var/lib/dhcpd/dhcpd.leases" | |
# read dhcpd_leases file and match all ip,mac pair, and convert to dict type to store | |
dhcp_leases = open(DHCPD_LEASES_FILE,"r").read() |
namespace :deploy do | |
## set max_hosts 20 or via env | |
set :max_hosts, ENV['MAXHOSTS'] || 20 | |
## set max_hosts on update_code | |
task :update_code, :except => { :no_release => true }, :max_hosts => "#{max_hosts}" do | |
logger.info "\e[0;31;1mNOTICE:\e[0m Pulling repo from #{repository}: max_hosts => '#{max_hosts}'" | |
on_rollback { run "rm -rf #{release_path}; true" } | |
strategy.deploy! | |
finalize_update |
default["ops-oob"]["rbenv_tar"] = "rbenv_6u2.tar.gz" |
# config/deploy.rb | |
namespace :deploy do | |
desc "check local vendor/cache" | |
task :bundled_package do | |
run_locally do | |
unless test "[[ -d #{File.expand_path("../../vendor/cache", __FILE__)} ]]" | |
error "please `bundle package --all` first!" | |
raise StandardError | |
end |
module Gem | |
class << self | |
## | |
# Returns full path of previous but one directory of dir in path | |
# E.g. for '/usr/share/ruby', 'ruby', it returns '/usr' | |
def previous_but_one_dir_to(path, dir) | |
split_path = path.split(File::SEPARATOR) | |
File.join(split_path.take_while { |one_dir| one_dir !~ /^#{dir}$/ }[0..-2]) |