Windows创建VHD加密盘、制作加密U盘教程

本来想下载百度上推荐的加密工具TrueCrypt,但是下载后打开,它弹窗说我电脑不是XP,说TrueCrypt项目早停止了,建议我用VHD跟BitLocker,于是我就一步一个脚印来设置VHD:1、win10用户快捷键windows+X键打开菜单,按K键打开磁盘管理2、点击操作->创建VHD3、在弹窗上选择位置,文件名随意例如4、我选择创建1G的盘,大小随意,点确定即可创建成功5、出现个新磁盘,带向下箭头的,点击它鼠标右键再点击初始化磁盘,分区格式随意,一般默认即可6、初始化后出现个未分配的磁盘,咱右键新建简单卷即可,后面的无脑下一步就好了,记得选择个合适的驱动号,例如我选择的驱动号是V,好了现在资源管理器出现了这个新磁盘7、我们右键它选择启用BitLocker8、输入密码后下一步,并将可以找回密码的凭证保存,最后一步若要用在U盘上使用 兼容模式 加密即可9、创建好了如图,不想用时可以跟U盘一样随时右键弹出10、使用时直接双击加密盘文件打开,会报错无法装载说要解锁,此时点击win10下边通知在弹窗中输入密码即可,如果这个密码框无意按没了,可以Windows+E打开资源管理器,点磁盘图标同样会出现密码框。以后vhd文件可以作为你的加密磁盘随时移动,可以移动到U盘、移动硬盘甚至备份到网盘。当然,其实你也可以给整个U盘进行bitlocker而不需要创建VHD,依据个人喜好使用吧!

Windows创建VHD加密盘、制作加密U盘教程

安卓MacroDroid充电语音提醒脚本

充电、拔掉电源、充满电都会有语音提醒,并且拔掉电源跟充满电会提示耗时多少充进去多少电。脚本如下,下载解压,文件管理器以MacroDroid打开方式打开即可。脚本下载:https://hik.lanzoux.com/iu045jwwlwb

MacroDroid Pro v5.8.4安卓版下载

这是一款十分强大的安卓自动任务软件,可以自行设置出发条件及执行事件,在此之前也写过几个帖子。操作比tasker更简易。下载地址:https://hik.lanzoux.com/ixP8Jjwtgij

在线证件照扣图网站稿定扣图

https://koutu.gaoding.com/

pycharm安装依赖包过慢解决方法

简单,在terminal中输入如下命令即可,例如安装requests:pip3 install requests -i http://pypi.douban.com/simple --trusted-host pypi.douban.com其他国内源参看:https://cway.top/post/831.html

java selenium webdriver无头模式参数设置

java webdriver无头模式参数设置Chrome设置mac linux需浏览器59版本以上,windows 60版本以上 ChromeOptions options = new ChromeOptions();// 设置 chrome 的无头模式 options.addArguments("--headless"); options.addArguments("--no-sandbox"); options.addArguments("--disable-gpu"); options.addArguments("--disable-dev-shm-usage"); WebDriver driver = new ChromeDriver(options);selenium add_argument 参数表https://peter.sh/experiments/chromium-command-line-switches/chrome_options.add_argument('--user-agent=""') # 设置请求头的User-Agentchrome_options.add_argument('--window-size=1280x1024') # 设置浏览器分辨率(窗口大小)chrome_options.add_argument('--start-maximized') # 最大化运行(全屏窗口),不设置,取元素会报错chrome_options.add_argument('--disable-infobars') # 禁用浏览器正在被自动化程序控制的提示chrome_options.add_argument('--incognito') # 隐身模式(无痕模式)chrome_options.add_argument('--hide-scrollbars') # 隐藏滚动条, 应对一些特殊页面chrome_options.add_argument('--disable-javascript') # 禁用javascriptchrome_options.add_argument('--blink-settings=imagesEnabled=false') # 不加载图片, 提升速度chrome_options.add_argument('--headless') # 浏览器不提供可视化页面chrome_options.add_argument('--ignore-certificate-errors') # 禁用扩展插件并实现窗口最大化chrome_options.add_argument('--disable-gpu') # 禁用GPU加速chrome_options.add_argument('–disable-software-rasterizer')chrome_options.add_argument('--disable-extensions')chrome_options.add_argument('--start-maximized')参考:https://blog.csdn.net/weixin_43968923/article/details/87899762火狐设置 FirefoxOptions options1 = new FirefoxOptions(); options1.addArguments("-headless");

Java selenium+webdriver使用教程

java selenium+webdriver使用教程webdriver驱动下载Chrome:http://npm.taobao.org/mirrors/chromedriver/https://chromedriver.storage.googleapis.com/index.htmlFirefox:https://github.com/mozilla/geckodriver/releases所需依赖只需要selenium-server依赖即可 <dependencies><!-- <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.141.59</version> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-api</artifactId> <version>3.141.59</version> </dependency>--> <!--或者用注释的坐标亦可--> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-server</artifactId> <version>3.141.59</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.13.1</version> </dependency> </dependencies>示例代码以下是模拟打开本站登陆页面,各位可使用Katalon Recorder浏览器插件自动生成代码,也可以参考下之前的一个示例 public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver", "C:\\Users\\Administrator\\Downloads\\chromedriver_win32\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); driver.manage().deleteAllCookies(); // 与浏览器同步非常重要,必须等待浏览器加载完毕 driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.get("https://cway.top"); Thread.sleep(2000); driver.findElement(By.linkText("登录后台")).click(); Thread.sleep(2000); driver.close(); driver.quit(); }其他操作打开各种浏览器//IE浏览器System.setProperty("webdriver.ie.driver", ".\\Tools\\IEDriverServer.exe");WebDriver driver = new InternetExplorerDriver();//ChromeSystem.setProperty("webdriver.chrome.driver", ".\\Tools\\chromedriver.exe");WebDriver driver = new ChromeDriver();//FireFox(自定义安装)System.setProperty("webdriver.firefox.bin", "D:\\ProgramFiles\\Mozilla Firefox\\firefox.exe");//FireFox版本大于48,默认安装System.setProperty("webdriver.firefox.marionette", ".\\Tools\\geckodriver.exe");//FireFox版本小于48System.setProperty("webdriver.firefox.marionette", ".\\Tools\\geckodriver.exe");WebDriver driver = new FirefoxDriver();亦可用ChromeDriverService类构建驱动String webDriverPath = LagouSpider.class.getResource("chromedriver.exe").getPath(); // 这里需要注意一定要和打开的Chrome版本匹配 System.setProperty("webdriver.chrome.driver", webDriverPath); // 构建驱动 ChromeDriverService service = new ChromeDriverService.Builder(). usingDriverExecutable(new File(webDriverPath)).usingAnyFreePort().build(); try { service.start(); } catch (IOException e) { e.printStackTrace(); } // 获取Web驱动 WebDriver driver = new RemoteWebDriver(service.getUrl(), DesiredCapabilities.chrome());只是最后要关闭service // 退出驱动线程 driver.quit(); // 关闭service服务 service.stop();打开URL// 后退,跳转到上一页driver.navigate().back();// 前进,跳转到下一页driver.navigate().forward ();// 当前页刷新driver.navigate().refresh();// 浏览器窗口最大driver.manage().window().maximize();// 自定义设置浏览器尺寸driver.manage().window().setSize(new Dimension(width, heigth));关闭浏览器// 关闭当前页面driver.close(); // 关闭由selenium所启动的所有页面driver.quit();返回当前页标题与URL // 返回当前页面的Ttile String title = driver.getTitle(); // 返回当前页面的url String currentUrl = driver.getCurrentUrl();其它常见方法// 返回当前的浏览器的窗口句柄 String currentWindowHandle = driver.getWindowHandle() // 返回当前的浏览器的所有窗口句柄 Set<String> allWindowHandles = driver.getWindowHandles(); // 返回当前页面的源码 String currentPageSource = getPageSource() // 通过xpath获取元素 使用By还可以通过其他条件获取 WebElement titleElement = driver.findElement(By.xpath(titleExpression)); //获取文本 String titleElementText = titleElement.getText(); //获取属性 String titleElementHref = titleElement.getAttribute("href");参考:https://www.cnblogs.com/andrew209/archive/2004/01/13/9011399.html

关闭HtmlUnit日志信息 屏蔽报错信息

对于htmlunit控制台报错信息不能关闭的情况,将下列代码加入报错代码前即可,例如可加在代码最前面LogManager.getLogManager().reset();其它方法可参考:https://blog.csdn.net/gyxscnbs/article/details/51357407对于纯java项目(未引入其它日志系统)的警告信息,可在classpath中加入logging.properties文件解决,文件内容:java.util.logging.ConsoleHandler.level = FINEjava.util.logging.ConsoleHandler.encoding = UTF-8

Maven固定jdk版本 将依赖包都打进jar包教程

很简单,pom中加入这两个插件即可,第一个插件指定要编译的jdk版本、编码等信息,第二个插件mainClass中填入jar启动类的全限定类名。 <build> <plugins> <!--强制maven以jdk8编译--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> </configuration> </plugin> <!--打包时包将所有依赖打进去--> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>Main</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </plugin> </plugins> </build>对于第一个插件,其它设置有<plugin> <!-- 指定maven编译的jdk版本,如果不指定,maven3默认用jdk 1.5 maven2默认用jdk1.3 --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <!-- 一般而言,target与source是保持一致的,但是,有时候为了让程序能在其他版本的jdk中运行(对于低版本目标jdk,源代码中不能使用低版本jdk中不支持的语法),会存在target不同于source的情况 --> <source>1.8</source> <!-- 源代码使用的JDK版本 --> <target>1.8</target> <!-- 需要生成的目标class文件的编译版本 --> <encoding>UTF-8</encoding><!-- 字符集编码 --> <skipTests>true</skipTests><!-- 跳过测试 --> <verbose>true</verbose> <showWarnings>true</showWarnings> <fork>true</fork><!-- 要使compilerVersion标签生效,还需要将fork设为true,用于明确表示编译版本配置的可用 --> <executable><!-- path-to-javac --></executable><!-- 使用指定的javac命令,例如:<executable>${JAVA_1_4_HOME}/bin/javac</executable> --> <compilerVersion>1.3</compilerVersion><!-- 指定插件将使用的编译器的版本 --> <meminitial>128m</meminitial><!-- 编译器使用的初始内存 --> <maxmem>512m</maxmem><!-- 编译器使用的最大内存 --> <compilerArgument>-verbose -bootclasspath ${java.home}\lib\rt.jar </compilerArgument><!-- 这个选项用来传递编译器自身不包含但是却支持的参数选项 --> </configuration></plugin>第二个插件执行打包,点击idea右侧 Maven -> 项目名 -> Plugins-> assembly -> assembly:assembly 执行即可,如图:

Maven固定jdk版本 将依赖包都打进jar包教程

Java获取js渲染后的html页面源码实战(获取金价)

以下代码获取京东积存金实时价格,并高于预期卖出价或低于预期买入价时弹窗或微信提醒。依赖依赖htmlunit、jsoup两个包,htmlunit用于获取页面,jsoup用于解析html获取指定值。<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.example</groupId> <artifactId>goldNotice</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> <maven.compiler.resource>1.8</maven.compiler.resource> <maven.compiler.target>1.8</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>net.sourceforge.htmlunit</groupId> <artifactId>htmlunit</artifactId> <version>2.45.0</version> </dependency> <dependency> <groupId>org.jsoup</groupId> <artifactId>jsoup</artifactId> <version>1.12.1</version> </dependency> </dependencies> <build> <plugins> <!--强制maven以jdk8编译--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> </configuration> </plugin> <!--打包时包将所有依赖打进去--> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>Main</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </plugin> </plugins> </build></project>代码import com.gargoylesoftware.htmlunit.BrowserVersion;import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;import com.gargoylesoftware.htmlunit.WebClient;import com.gargoylesoftware.htmlunit.html.HtmlPage;import org.jsoup.Jsoup;import org.jsoup.nodes.Document;import org.jsoup.select.Elements;import javax.swing.*;import java.io.BufferedReader;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.net.HttpURLConnection;import java.net.MalformedURLException;import java.net.URL;import java.net.URLConnection;import java.util.Date;import java.util.logging.LogManager;public class Main { public static void main(String[] args) { LogManager.getLogManager().reset();// 预期卖出价 float expectPrice = 399;// 预期买入价 float lowPrice = 390;// 间隔时间 默认2s long sec = 2000;// 请求等待时间 long reqSec = 5000; for (int i = 0; i <= 3; i++) { if (args.length > 0 && i == 0) expectPrice = Float.parseFloat(args[0]); if (args.length > 1 && i == 1) lowPrice = Float.parseFloat(args[1]); if (args.length > 2 && i == 2) sec = Long.parseLong(args[2]); if (args.length > 3 && i == 3) reqSec = Long.parseLong(args[3]); } System.out.println("数据加载中请稍候……"); WebClient webClient = new WebClient(BrowserVersion.CHROME);//模拟CHROME浏览器 try { webClient.setJavaScriptTimeout(5000); webClient.getOptions().setUseInsecureSSL(true);//接受任何主机连接 无论是否有有效证书 webClient.getOptions().setJavaScriptEnabled(true);//设置支持javascript脚本 webClient.getOptions().setCssEnabled(false);//禁用css支持 webClient.getOptions().setThrowExceptionOnScriptError(false);//js运行错误时不抛出异常 webClient.getOptions().setTimeout(100000);//设置连接超时时间 webClient.getOptions().setDoNotTrackEnabled(false); HtmlPage page = webClient.getPage("https://m.jdjygold.com/finance-gold/newgold/index/?ordersource=2&jrcontainer=h5&jrlogin=true&utm_source=Android_url_1609033920704&utm_medium=jrappshare&utm_term=wxfriends");// 加载js需要时间故延迟默认5s Thread.sleep(reqSec); while (true) {// 使用Jsoup解析html Document document = Jsoup.parse(page.asXml()); Elements span01 = document.getElementsByClass("price_span01"); String price = span01.text(); String localeString = new Date().toLocaleString(); System.out.println(localeString + " " + price); String msg = localeString + "价格已达到预定值:" + price; String lowMsg = localeString + "价格已低于预定值:" + price; float goldPrice = Float.parseFloat(price); if (msg != null && goldPrice >= expectPrice) { JOptionPane.showConfirmDialog(null, msg, "达到预期卖出价提示", JOptionPane.CLOSED_OPTION);// 若部署在服务器上则使用Server酱提醒// getUrl("https://sc.ftqq.com/xxxxxxxxxxxxxx.send?text="+msg); return; } if (msg != null && goldPrice <= lowPrice) { JOptionPane.showConfirmDialog(null, lowMsg, "低于预期买入价提示", JOptionPane.CLOSED_OPTION);// getUrl("https://sc.ftqq.com/xxxxxxxxxxxxxx.send?text="+lowMsg); return; } Thread.sleep(sec); } } catch (FailingHttpStatusCodeException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } catch (MalformedURLException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } catch (IOException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } catch (InterruptedException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } finally { webClient.close(); } } public static void getUrl(String toUrl) throws IOException { URL url = new URL(toUrl); //建立连接 URLConnection urlConnection = url.openConnection(); //连接对象类型转换 HttpURLConnection httpURLConnection = (HttpURLConnection) urlConnection; //设定请求方法 httpURLConnection.setRequestMethod("GET"); //获取字节输入流信息 InputStream inputStream = httpURLConnection.getInputStream(); //字节流转换成字符流 InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "utf-8"); //把字符流写入到字符流缓存中 BufferedReader bufferedReader = new BufferedReader(inputStreamReader); String line = null; //读取缓存中的数据 while ((line = bufferedReader.readLine()) != null) { System.out.println(line); } //关闭流 inputStream.close(); }}使用方法打包后直接执行命令java -jar xxx.jar 390 360第一个数字为预期卖出价;第二个为预期买入价,即当价格高于390或低于360提醒并关闭程序。第三个参数设置间隔时间,单位毫秒;第四个参数设置请求等待时间,即启动时加载数据的等待时间,有时候网络不好时间短可能加载不出来,代码不填时默认5s,一般足矣无需带第四个参数。例如:java -jar goldNotice-1.0-SNAPSHOT-jar-with-dependencies.jar 400 391.6 2500 3000在服务器上部署请配置Server酱key并将弹窗代码注释。更多拓展可自行修改代码。