IPSec scale config script over Cisco Router

Pandas入门教程(二十二):股票数据分析实战——yfinance 获取数据、技术指标与收益率分析 把 Pandas 用在真实场景,才能体会它的价值。本文以茅台股票为例,用 yfinance 获取历史行情,完成缺失值处理与列筛选,绘制收盘价曲线,计算 SMA 移动平均线与 RSI 相对强弱指数,并通过日收益率、累计收益率和波动率完成完整的量化分析流程。 阅读详情

该脚本支持了SVTI模式的config scale


from xml.dom import minidom
from ftplib import FTP
import telnetlib
import sys
import time
import logging
import os
import re
import platform
import string

class IPSecConfigScale:
    def __init__(self, tunnel, mode):
        self.__tunnel_number__ = int(tunnel)
        self.__mode__ = mode
        
        self.__vlan_start__ = 2000
        
        self.__ip_wan_A__ = '50.1.'
        self.__ip_wan_B__ = self.__ip_wan_A__
        self.__ip_lan_A__ = '172.16.'
        self.__ip_lan_B__ = '172.17.'
        self.__netmask__ = '255.255.255.0'
        self.__wildcard__ = '0.0.0.255'
        self.__interface_lan_A__ = 'GigabitEthernet2.'
        self.__interface_wan_A__ = 'GigabitEthernet3.'
        self.__interface_lan_B__ = 'GigabitEthernet2.'
        self.__interface_wan_B__ = 'GigabitEthernet3.'
        
        self.__vlan_lan_A__ = 2000
        self.__vlan_wan__ = 3000
        self.__vlan_lan_B__ = 4000
        
        self.__eigrp_as__ = 1000
        
        return
        
    def run(self):
    	print 'tunnel is %s' % self.__tunnel_number__
    	print 'mode is %s' % self.__mode__
    	
    	if self.__tunnel_number__ >= 255:
    	    print 'ERROR, %s is not supported' % self.__tunnel_number__

    	if mode == 'ikev2':
    		self.__scale_ikev2_config__(ip_lan_local_in = self.__ip_lan_A__, 
    		    ip_wan = self.__ip_wan_A__, 
    		    ip_lan_remote_in=self.__ip_lan_B__, 
    		    interface_lan = self.__interface_lan_A__, 
    		    interface_wan = self.__interface_wan_A__, 
    		    vlan_lan_in=self.__vlan_lan_A__, 
    		    vlan_wan_in=self.__vlan_wan__, 
    		    role=1)
    		self.__scale_ikev2_config__(ip_lan_local_in = self.__ip_lan_B__, 
    		    ip_wan = self.__ip_wan_B__, 
    		    ip_lan_remote_in=self.__ip_lan_A__, 
    		    interface_lan = self.__interface_lan_B__, 
    		    interface_wan = self.__interface_wan_B__, 
    		    vlan_lan_in=self.__vlan_lan_B__, 
    		    vlan_wan_in=self.__vlan_wan__, 
    		    role=2)
    	elif mode == 'svti':
    		self.__scale_svti_config__()
    	else:
    		print '%s is not supported'
    		
    	return

    def __scale_svti_config__(self):
        self.__svti_wan_ip_A__ = '192.168.1.1'
        self.__svti_wan_ip_B__ = '192.168.1.2'
        self.__svti_wan_interface_A__ = 'GigabitEthernet2.880'
        self.__svti_wan_interface_B__ = 'GigabitEthernet0/0/0.880'
                
        self.__svti_interface_loopback__ = 1000
        
        self.__svti_loopback_ip_A__ = '10.1'
        self.__svti_loopback_ip_B__ = '10.2'
        
        self.__svti_tunnel_ip_A__ = '80.1'
        self.__svti_tunnel_ip_B__ = '80.1'
        
        self.__svti_network__ = '255.255.255.0'
        
        
    	print '###################################'
    	print '###################################'
    	print '# config for Cisco Router A:'
    	print 'configure terminal'
    	print 'interface %s' % self.__svti_wan_interface_A__
    	print '  ip address %s %s' % (self.__svti_wan_ip_A__, self.__svti_network__)
    	print 'crypto keyring KEYS'  
    	print '  pre-shared-key address 0.0.0.0 0.0.0.0 key cisco'
    	print 'crypto isakmp policy 10'
    	print ' encr 3des'
    	print ' hash sha256'
    	print ' authentication pre-share'
    	print ' group 2'
    	print ' lifetime 600'
    	print 'crypto isakmp profile ISAKMPP'
    	print '   keyring KEYS'
    	print '   match identity address 0.0.0.0' 
    	print 'crypto ipsec transform-set TS esp-aes 256 esp-sha256-hmac'
    	print ' mode tunnel'
    	print 'crypto ipsec profile IPSECPP'
    	print ' set transform-set TS'
    	print ' set isakmp-profile ISAKMPP'
    	
    	for it in range(0, self.__tunnel_number__):
    	    number = self.__svti_interface_loopback__ + it
    	    svti_loopback_ip_A = '%s.%s.1' % (self.__svti_loopback_ip_A__, it)
    	    svti_loopback_ip_B = '%s.%s.1' % (self.__svti_loopback_ip_B__, it)
    	    svti_tunnel_ip_A = '%s.%s.1' % (self.__svti_tunnel_ip_A__, it)
    	    
    	    print 'interface loopback %s' % number
    	    print '  ip address %s %s' % (svti_loopback_ip_A, self.__svti_network__)
    	    
    	    print 'interface tunnel %s' % number
    	    print '  ip address %s %s' % (svti_tunnel_ip_A, self.__svti_network__)
    	    print '  tunnel source loopback %s' % number
    	    print '  tunnel mode ipsec ipv4'
    	    print '  tunnel destination %s' % svti_loopback_ip_B
    	    print '  tunnel protection ipsec profile IPSECPP'

    	print 'end'
    	    	
        print '###################################'
    	print '###################################'
    	print '# config for Cisco Router B:'
    	print 'configure terminal'
    	print 'interface %s' % self.__svti_wan_interface_B__
    	print '  ip address %s %s' % (self.__svti_wan_ip_B__, self.__svti_network__)
    	print 'crypto keyring KEYS'  
    	print '  pre-shared-key address 0.0.0.0 0.0.0.0 key cisco'
    	print 'crypto isakmp policy 10'
    	print ' encr 3des'
    	print ' hash sha256'
    	print ' authentication pre-share'
    	print ' group 2'
    	print ' lifetime 600'
    	print 'crypto isakmp profile ISAKMPP'
    	print '   keyring KEYS'
    	print '   match identity address 0.0.0.0' 
    	print 'crypto ipsec transform-set TS esp-aes 256 esp-sha256-hmac'
    	print ' mode tunnel'
    	print 'crypto ipsec profile IPSECPP'
    	print ' set transform-set TS'
    	print ' set isakmp-profile ISAKMPP'
    	
    	for it in range(0, self.__tunnel_number__):
    	    number = self.__svti_interface_loopback__ + it
    	    svti_loopback_ip_A = '%s.%s.1' % (self.__svti_loopback_ip_A__, it)
    	    svti_loopback_ip_B = '%s.%s.1' % (self.__svti_loopback_ip_B__, it)
    	    svti_tunnel_ip_B = '%s.%s.1' % (self.__svti_tunnel_ip_B__, it)
    	    
    	    print 'interface loopback %s' % number
    	    print '  ip address %s %s' % (svti_loopback_ip_B, self.__svti_network__)
    	    
    	    print 'interface tunnel %s' % number
    	    print '  ip address %s %s' % (svti_tunnel_ip_B, self.__svti_network__)
    	    print '  tunnel source loopback %s' % number
    	    print '  tunnel mode ipsec ipv4'
    	    print '  tunnel destination %s' % svti_loopback_ip_A
    	    print '  tunnel protection ipsec profile IPSECPP'

    	print 'end'
    	
    	print '###################################'
    	print '###################################'
    	print '# unconfig for Cisco Router A and B:'
    	print 'configure terminal'
    	
    	for it in range(0, self.__tunnel_number__):
    	    number = self.__svti_interface_loopback__ + it
            print 'no interface tunnel %s' % number
    	    print 'no interface loopback %s' % number

        print 'no crypto ipsec profile IPSECPP'
        print 'no crypto isakmp profile ISAKMPP'
        print 'no crypto keyring KEYS'
        print 'no crypto isakmp policy 10'
        print 'no crypto ipsec transform-set TS esp-aes 256 esp-sha256-hmac'

    	print 'end'
        
        return 
    	    	
    def __scale_ikev2_config__(self, ip_lan_local_in='172.16.', 
            ip_wan='50.1.', 
            ip_lan_remote_in='60.1.', 
            interface_lan='GigabitEthernet2.', 
            interface_wan='GigabitEthernet3.', 
            vlan_lan_in=2000, 
            vlan_wan_in=3000, 
            role=1):
    	
    	print '###################################'
    	print '###################################'
    	print '# config for Cisco Router(role: %s):' % role
    	print 'configure terminal'
    	for it in range(0, self.__tunnel_number__):
    	    proposal = 'IKEv2Proposal%s' % it
    	    policy = 'IKEv2Policy%s' % it
    	    key = 'KEY%s' % it
    	    peer = 'PEER%s' % it
    	    profile = 'IKEv2Profile%s' % it
    	    transform_set = 'TS%s' % it
    	    map = 'CMAP%s' % it

    	    vlan_lan = vlan_lan_in + it
    	    vlan_wan = vlan_wan_in + it
    	        	    
    	    if role == 1:
    	        ip_wan_local =  '%s%s.1' % (ip_wan, it) 
    	        ip_wan_remote = '%s%s.2' % (ip_wan, it) 
    	    else:
    	        ip_wan_local =  '%s%s.2' % (ip_wan, it) 
    	        ip_wan_remote = '%s%s.1' % (ip_wan, it) 
    	        
    	    ip_lan_local = '%s%s.%s' % (ip_lan_local_in, it, 1)
    	    ip_lan_remote = '%s%s.%s' % (ip_lan_remote_in, it, 1)
    	        	        
    	    subinterface_lan = '%s%s' % (interface_lan, vlan_lan)
    	    subinterface_wan = '%s%s' % (interface_wan, vlan_wan)
    	    
    	    traffic_acl = 'traffic_acl_%s' % it
    	    
    	    eigrp_as = 1000 +it

    	    # traffic acl
    	    print '# traffic ACL'
            print 'ip access-list extended %s' % traffic_acl
            print ' permit ip host %s any' % ip_lan_local
            print ' permit ip host %s any' % ip_lan_remote
    	    
    	    # ikev2 proposal
    	    print '# IKEv2 proposal'
            print 'crypto ikev2 proposal %s' % proposal
            print '  encryption 3des'
            print '  integrity sha512'
            print '  group 2'
            
            # ikev2 policy
    	    print '# IKEv2 policy'
            print 'crypto ikev2 policy %s' % policy
            print '  proposal %s' % proposal
            
            # ikev2 keyring
    	    print '# IKEv2 keyring'
            print 'crypto ikev2 keyring %s' % key
            print '  peer %s' % peer
            print '    address %s' % ip_wan_remote
            print '    pre-shared-key local cisco123'
            print '    pre-shared-key remote cisco123'
            
            # ikev2 profile
    	    print '# IKEv2 profile'
            print 'crypto ikev2 profile %s' % profile
            print '  match identity remote address %s 255.255.255.255' % ip_wan_remote
            print '  identity local address %s' % ip_wan_local
            print '  authentication local pre-share'
            print '  authentication remote pre-share'
            print '  keyring local %s' % key
            
            # ipsec transform-set
    	    print '# IPSec transform-set'
            print 'crypto ipsec transform-set %s esp-aes 256 esp-sha256-hmac' % transform_set

            # crypto map
    	    print '# crypto map'
            print 'crypto map %s 10 ipsec-isakmp' % map
            print ' set peer %s' % ip_wan_remote
            print ' set transform-set %s' % transform_set
            print ' set ikev2-profile %s' % profile
            print ' match address %s' % traffic_acl
            
            # subinterface wan
    	    print '# wan subinterface'
            print 'interface %s' % subinterface_wan
            print '  encapsulation dot1q %s' % vlan_wan
            print '  ip address %s %s' % (ip_wan_local, self.__netmask__)
            print '  crypto map %s' % map

            # subinterface lan
    	    print '# lan subinterface'
            print 'interface %s' % subinterface_lan
            print '  encapsulation dot1q %s' % vlan_lan
            print '  ip address %s %s' % (ip_lan_local, self.__netmask__)
            
            # static route
            print 'ip route %s 255.255.255.255 %s' % (ip_lan_remote, ip_wan_remote)
            
            print 'end'
    	return
    	
    	
def printHelp():
    print '\nError running command!\n\n'
    print 'Please run it as following indication:'
    print 'COMMAND <tunnel number> [mode]\n'
    print 'For Example:'
    print '    python IPSecConfigScale.py 10 ikev2\n\n'
    
    return -1

if __name__ == "__main__":
    numargs = len(sys.argv) - 1

    if numargs == 0:
    	tunnel = 10
    	mode = 'ikev2'
    elif numargs == 1:
        tunnel = sys.argv[1]
        mode = 'ikev2'
    elif numargs == 2:
        tunnel = sys.argv[1]
        mode = sys.argv[2]
    else:
    	printHelp()
        sys.exit(1)
        
    scale = IPSecConfigScale(tunnel, mode)
    scale.run()


运行情况:


python ipsec_config_scale.py 2 svti
tunnel is 2
mode is svti
###################################
###################################
# config for Cisco Router A:
configure terminal
interface GigabitEthernet2.880
  ip address 192.168.1.1 255.255.255.0
crypto keyring KEYS
  pre-shared-key address 0.0.0.0 0.0.0.0 key cisco
crypto isakmp policy 10
 encr 3des
 hash sha256
 authentication pre-share
 group 2
 lifetime 600
crypto isakmp profile ISAKMPP
   keyring KEYS
   match identity address 0.0.0.0
crypto ipsec transform-set TS esp-aes 256 esp-sha256-hmac
 mode tunnel
crypto ipsec profile IPSECPP
 set transform-set TS
 set isakmp-profile ISAKMPP
interface loopback 1000
  ip address 10.1.0.1 255.255.255.0
interface tunnel 1000
  ip address 80.1.0.1 255.255.255.0
  tunnel source loopback 1000
  tunnel mode ipsec ipv4
  tunnel destination 10.2.0.1
  tunnel protection ipsec profile IPSECPP
interface loopback 1001
  ip address 10.1.1.1 255.255.255.0
interface tunnel 1001
  ip address 80.1.1.1 255.255.255.0
  tunnel source loopback 1001
  tunnel mode ipsec ipv4
  tunnel destination 10.2.1.1
  tunnel protection ipsec profile IPSECPP
end
###################################
###################################
# config for Cisco Router B:
configure terminal
interface GigabitEthernet0/0/0.880
  ip address 192.168.1.2 255.255.255.0
crypto keyring KEYS
  pre-shared-key address 0.0.0.0 0.0.0.0 key cisco
crypto isakmp policy 10
 encr 3des
 hash sha256
 authentication pre-share
 group 2
 lifetime 600
crypto isakmp profile ISAKMPP
   keyring KEYS
   match identity address 0.0.0.0
crypto ipsec transform-set TS esp-aes 256 esp-sha256-hmac
 mode tunnel
crypto ipsec profile IPSECPP
 set transform-set TS
 set isakmp-profile ISAKMPP
interface loopback 1000
  ip address 10.2.0.1 255.255.255.0
interface tunnel 1000
  ip address 80.1.0.1 255.255.255.0
  tunnel source loopback 1000
  tunnel mode ipsec ipv4
  tunnel destination 10.1.0.1
  tunnel protection ipsec profile IPSECPP
interface loopback 1001
  ip address 10.2.1.1 255.255.255.0
interface tunnel 1001
  ip address 80.1.1.1 255.255.255.0
  tunnel source loopback 1001
  tunnel mode ipsec ipv4
  tunnel destination 10.1.1.1
  tunnel protection ipsec profile IPSECPP
end
###################################
###################################
# unconfig for Cisco Router A and B:
configure terminal
no interface tunnel 1000
no interface loopback 1000
no interface tunnel 1001
no interface loopback 1001
no crypto ipsec profile IPSECPP
no crypto isakmp profile ISAKMPP
no crypto keyring KEYS
no crypto isakmp policy 10
no crypto ipsec transform-set TS esp-aes 256 esp-sha256-hmac
end



【信息科学与工程学】【数据中心】 第七篇 智算中心CLOS组网整体设计 区域主要功能网络要求技术选型安全等级可用性要求训练区​大规模AI模型训练,分布式计算超高带宽(100G+),超低延迟(<1ms),无损网络RoCEv2,PFC,DCQCN,多路径P4(最高)99.99%推理区​实时AI推理,模型服务低延迟(<10ms),高可用,弹性扩展智能负载均衡,服务网格,容器网络P3(高)99.999%公共服务区​统一认证,API网关,数据服务多租户隔离,安全防护,弹性带宽VXLAN,EVPN,微隔离P3(高)99.99%存储区​高性能存储,数据湖超高带宽,低延迟,高IOPSNVMe- 阅读详情

相关推荐

【信息科学与工程学】【通信工程】第五十九篇 IP网络设计01

IP网络设计不是只写ip address;它本质是的问题,所以参数天然分布在:层级例子物理/传输(可选但你会要求光路/电路)光功率/OSNR/色散/衰减/BER/FEC;铜/微波链路预算L1/L2 链路模型速率、MTU、成帧开销、串行化、传播时延、缓冲排队/调度/QoS服务曲线、令牌桶、延迟界、丢包概率近似路由/TE/可靠性流守恒、路径容量、切换/收敛时间信息论/可达性Shannon 上限、FEC 有效码率、链路容量 after overhead计算科学/数值。

weixin_49199313的博客 511

Scale IPSec config over cisco router

Cisco Router 的IPSec配置很复杂,如果需要生成多条tunnel的配置的时候,需要很大的工作量 简单写了一个脚本来生成,看看结果如何把 Limitation: 1. 支持IKEv2 2. 只能在Cisco IOS router上运行 3. Topology: site to site Benifit: 同时生成A和B两个router的配置,赞吧?

跳着Samba的狮子 743

IPsec (主模式,野蛮模式)

IPsec vpn的主模式和野蛮模式

七汣的博客 3414

Telnet: Error opening terminal: network

Python telnet Error opening terminal: network ansi xterm

跳着Samba的狮子 1409

从原理到代码:一文搞懂LFM信号脉冲压缩在Matlab中的实现

本文深入解析了LFM信号脉冲压缩的核心原理与Matlab实现方法。从线性调频信号的数学表达、时频特性入手,详细讲解了如何构建多目标回波仿真环境,并重点阐述了匹配滤波器的频域实现算法。文章提供了完整的、可运行的Matlab代码,涵盖信号生成、噪声添加、脉冲压缩及性能评估等关键步骤,并探讨了加窗处理、参数选择等工程实践中的考量,为雷达信号处理的学习与实践提供了清晰指南。

weixin_29063035的博客 415

BPMN-JS :修改节点“Change Type”事件类型

修改路径:node_modules\bpmn-js\lib\features\replace\ReplaceOptions.js。

TaylorY的博客 678

python获取当前日期前后N天或N月的日期

<br />#!/usr/bin/python ''' Filename: "utildate.py" author: "zhangsong" date : "2009-03-24" version: "1.00" ''' from time import strftime, localtime from datetime import timedelta, date import calendar year = strftime("%Y",localtime()) mo

跳着Samba的狮子 1378

用Quartus II和LPM_ROM手把手复现西电计组课设:从微指令到五条指令的完整流程

本文详细介绍了使用Quartus II和LPM_ROM复现西电计组课设的完整流程,从微指令编写到五条指令的实现。通过环境搭建、LPM_ROM配置、微程序设计及调试技巧,帮助读者高效完成课程设计,避开常见问题。适合计组课程设计的学习者和实践者参考。

weixin_29288313的博客 456

python字符串操作(连接、比较、格式化等)

<br /> <!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 680460288 22 0 262145 0;}

跳着Samba的狮子 814

RTL优化与PPA分析:数字电路设计的关键技术

在数字集成电路设计中,RTL(寄存器传输级)优化是提升芯片性能、降低功耗和减小面积的核心技术。通过PPA(Power-Performance-Area)指标的平衡,工程师可以在不同时序约束下实现设计的最优化。本文基于Synopsys Design Compiler和开源工具Yosys的实验数据,展示了RTL优化在算术单元和控制逻辑中的显著效果,特别是在乘法器和除法器等复杂运算模块中。文章还探讨了AI辅助工具在RTL优化中的应用潜力,为数字电路设计提供了实用的技术参考和工程实践建议。

weixin_42186387的博客 619

VSCode配置C/C++开发环境:从零安装MinGW-w64并运行第一个C程序

在Windows系统上搭建C语言开发环境时,很多初学者混淆编辑器、编译器与调试器的分工,导致配置过程屡屡受挫。理解VSCode作为轻量级编辑器的定位,以及MinGW-w64提供的gcc编译器在源码编译中的核心作用,是顺利完成环境配置的关键。环境变量的正确设置直接影响gcc命令能否全局调用,而C/C++插件则赋予编辑器语法高亮与智能提示能力。通过安装VSCode、配置MinGW-w64、安装插件、汉化界面并运行一个最简单的hello.c程序,就能系统掌握这套开源工具链的完整工作流。无论是用于课程学习、算法练习

weixin_42531923的博客 531

AI全栈实战 | 3.9-01 爬虫入门:requests 加 BeautifulSoup 三分钟跑通,但 90% 的人栽在这 4 个“礼貌“问题上

⚠️:本文内容仅用于。请遵守目标站点的服务条款与相关法律法规,不得对目标服务造成负担,不得采集、传播个人隐私数据。技术是中性的,边界在你手里。爬虫的入门技术(requests 发请求 + BeautifulSoup 解析)三分钟就能学会。真正区分"会用爬虫"和"会做爬虫的人"的,是这篇我们跑通"请求→解析→存储"的最小闭环,然后重点把"合规与礼貌"这根弦给你绷上。

源码获取 | 运行部署 | 定制二开修改,如果回复不及时请耐心等待,请见谅。 403

更新|芒果YOLOv8改进182:注意力机制MLLA:即插即用|融合 Mamba 设计精髓的线性注意力视觉Transformer

芒果YOLOv8改进:即插即用,最新注意力机制MLLA:融合 Mamba 设计精髓的线性注意力视觉Transformer

包括YOLOv5、YOLOv7、YOLOv8等模型改进 864

从一段视频到可漫游的 4D 有声场景:思路拆解与最小复现手记

只需一段手机视频,你就能生成可"走进去"的 4D 有声场景:转头时狗叫声方向随之变化,走近时声音更清晰。本文拆解 Video-to-4DAVScene 的核心思路,手把手带你用几十行 Python 搭出最小管线,把视频中的运动物体变成带空间位置的声源,并附上三个真实踩坑的排障经验,代码可直接跑。🎧

helloagent的博客 232

基于STM32+华为云设计的智能鱼缸

本项目基于STM32单片机设计一款基于物联网的智能鱼缸系统,并通过应用侧接口开发上位机APP实现远程对鱼缸参数的检测和控制。该系统包括水温检测、水质检测、自动或手动换水、氛围灯灯光变换和自动或手动喂食等功能,可以帮助用户更好地管理鱼缸,提高鱼儿的生存率,同时增强用户对家庭装饰品的掌控感和科技感。

1万+

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

【每天一个 Python 小案例30】Python 基础知识综合小项目:我的工具盒

作为系列收官,本篇把前 29 篇的知识点合成一个能直接用的命令行工具"我的工具盒":计算器(用 ast 解析表达式,不碰 eval)、单位换算与温度转换(一张换算表 + 特例分支)、记账与分类统计(Decimal + JSON 持久化)、以及用"字典当命令表"把菜单和业务逻辑解耦的主循环。文中对比了 eval 的安全隐患与 ast 白名单的做法,解释了 lambda 闭包在字典里的写法与晚绑定陷阱,并在最后给出整个系列的知识地图,把变量、数据结构、控制流、函数、类、异常、文件、标准库八块内容对应到具体篇目。

xinjiyaya的博客 424

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

Python+Agent入门笔记(二):列表推导式、模块和异常,这些写 Agent 前得会

接上一篇《Python+Agent入门笔记(一)》。基础语法跑通之后,这篇聊几块日常写脚本绕不开的东西。还是按 JS/Go 开发者的视角写,尽量记录我实际卡过的地方。

qq_41241612的博客 430

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

详解Python条件语句

在 Python 中,if...else 是一种条件语句,可以根据给定的条件执行不同的操作。这个语句通常用于控制程序的流程。

2601_96798737的博客 205

Python3 协程:异步编程的核心机制与实战

协程是解决I/O密集型任务等待瓶颈的高效机制,相比线程更轻量、无锁开销。从yield到async/await的演进,使异步编程语义清晰、易于理解。通过async/await可实现并发执行多个任务(如gather、create_task),显著提升网络请求、爬虫等场景性能。关键在于使用异步库(如aiohttp)替代同步库,避免阻塞事件循环。合理控制超时与并发数,才能发挥协程最大优势。

Lxn2zh的博客 159

python如何控制浏览器

Python 可以通过 Selenium、Playwright 等工具实现浏览器自动化,从打开网页到执行复杂交互操作均可脚本化完成。Selenium生态成熟

2601_96797912的博客 76

二进制木马免杀-Python 分离免杀与 Web 挂马

二进制木马免杀-Python 分离免杀与 Web 挂马

2503_94637398的博客 268

torch.compile 差异仅 1e-6,边界样本预测为何翻转

torch.compile 加速后输出与 eager 不一致,部分预测翻转。逐层对比与 graph break 分析定位到动态分支翻转根因。容差回归仅适用于无分支翻转场景,零容忍场景应禁用编译。

昨日种种,皆成今我。今日种种,皆成新我。 159

Python 100讲课程导航:第08篇《Python input 与类型转换:构建可靠的交互程序》

本文详解Python中input()的返回类型为字符串,强调必须通过int()、float()等函数进行类型转换。重点讲解了输入验证的重要性,结合try-except处理ValueError等异常,实现可靠的交互程序。通过购物预算计算器实战,演示如何防范非法输入、处理边界值,并推荐使用Decimal避免浮点精度问题,提升程序健壮性。

铭渊老黄 134

【Python】国家中小学智慧教育平台电子教材批量下载与 PDF 合成实战

成果:两本语文电子课本(一年级上册 118 页 / 23MB、三年级上册 130 页 / 30.3MB),合计 248 页、约 54MB,单本下载加合成 40~60 秒,PDF 页数校验全部通过。经验教训SPA 站点的数据接口优先从 bundle 里挖,比抓页面稳得多;资源链接要按 private/public 分组看待,只取平台公开部分;页数、目录名这类“可推断”的信息,永远用实际响应验证一次;受限环境里“能不能跑浏览器”要在方案定稿前确认。后续计划:这版 PDF 是图片版,没有文字层;

木头大左的博客 133

魔塔社区微调训练Qwen2-1.5B-Instruct模型并烧录到‌RK3568开发板教程

本文基于Ubuntu 22.04 + CUDA 13.0.3环境,使用LLaMA-Factory框架对Qwen2-1.5B-Instruct模型进行LoRA微调,训练儿童故事生成专用模型。通过配置qwen模板、制作alpaca格式数据集、执行sft训练并合并LoRA权重,最终将模型转换为GGUF格式,并量化为Q4_K_M以适配RK3568嵌入式平台。全程支持国产镜像加速下载与显存优化,实现高效轻量化部署。

浅清秋慕夏的博客 185
上一篇: Scale IPSec config over cisco router
下一篇: CSR1000v XML file over KVM
wunderup
博客等级 码龄20年 13粉丝 79原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值