移除WordPress头部的window._wpemojiSettings代码及dns-prefetch
星期四, 2019-12-12 | Author: Lee | wordpress | 没有评论 444 views
升级到新版的wordpress的,看了下页面好多emojo的 js定义代码,对我也没有多大用,移除之.
头部还添加了dns-prefetch,从s.w.org预获取表情和头像,但s.w.org国内无法访问也是浪费.
在主题编辑 functions.php 文件中最后添加即可
//remove emoji remove_action( 'admin_print_scripts', 'print_emoji_detection_script'); remove_action( 'admin_print_styles', 'print_emoji_styles'); remove_action( 'wp_head', 'print_emoji_detection_script', 7); remove_action( 'wp_print_styles', 'print_emoji_styles'); remove_filter( 'the_content_feed', 'wp_staticize_emoji'); remove_filter( 'comment_text_rss', 'wp_staticize_emoji'); remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email'); //remove dns-prefetch remove_action( 'wp_head', 'wp_resource_hints', 2 ); |
刷新页面可以看到那一堆js消失了.
docker开启centos7的ssh远程连接及systemctl的放弃
星期四, 2019-12-12 | Author: Lee | computer, linux, Synology群晖 | 没有评论 936 views
群晖中docker开启centos7的ssh远程连接及systemctl的放弃
0.在群晖里开了centos想开启ssh连接由此记录
但是仍然无法开启systemctl功能,在配置中启用 ENTRYPOINT:/usr/sbin/init
虽然能启动systemctl 但是容器一旦重启就再也无法拉起,启动此容器失败会报cgroup的错误,然后再重建centos都会出问题,只有重启群晖解决,
里面大概是需要设置docker的一些东西,懒得搞了遂放弃,不想在群晖的主机中用命令行再折腾了
以后有需要再玩.
1. 安装passwd,openssl,openssh-server,net-tools
yum -y update yum install passwd openssl openssh-server net-tools -y |
启动sshd:
# /usr/sbin/sshd -D &
正常启动需要pid文件存在,可以创建/var/run/ssh
golang启用cron的定时任务
星期三, 2019-12-11 | Author: Lee | golang | 没有评论 637 views
0.起因用golang写了个自动备份mysql数据库的工具
把原来用shell脚步写的工具,封装成可执行文件,配置对应的密码参数即可自动执行,方便数据的自动备份
现在都用云数据库了,这种脚本也越来越不需要用了,直接保留镜像就好了,从小网站节省成本还是需要做的,只做全量备份即可.
闲话:还准备自动同步备份文件到多台机器,感觉golang写工具还是爽哉,想要工具可以赞赏我哈^-^
1.工具要用到定时执行启用cron
使用 https://github.com/robfig/cron 这个包,它实现了 cron 规范解析器和任务运行器
具体使用可以参加起使用说明,新版已经不直接支持秒的功能需要启用秒需要 c :=cron.New(cron.WithSeconds())即可
letsencrypt的https证书续期遭遇raw.githubusercontent.com无法访问
星期日, 2019-12-08 | Author: Lee | linux | 没有评论 1,111 views
今天看到邮件提醒letsencrypt的https的证书快要到期了,想想自己设置了自动续期怎么还会有邮件提醒呢?
登录服务器查看,发现续期的脚本执行有错…
访问:https://raw.githubusercontent.com/certbot/certbot/v1.0.0/letsencrypt-auto-source/letsencrypt-auto
出现了无法连接,拒绝访问,解决之,重试脚本,升级完成.
0. ping raw.githubusercontent.com 获取的IP地址:151.101.108.133已经无法访问,连接重置了
1.访问ipaddress.com,或者使用ip lookup 工具获得相关域名的ip地址
当前查询:https://githubusercontent.com.ipaddress.com/raw.githubusercontent.com 的IP地址为:
IP Address 199.232.28.133
2.hosts添加指向此IP地址
sudo vi /etc/hosts 199.232.28.133 raw.githubusercontent.com |
3.重新执行续期脚本,等待升级即可.
centos7开启sshd多端口登录及修改端口
星期三, 2019-12-04 | Author: Lee | Database, linux | 2 Comments 428 views
0.不知道怎么回事 一台国外的机器的ssh的22端口,时常无法ssh连接,因此多加个端口来备用
1.编辑配置文件打开Port=22 或者修改此端口
vi /etc/ssh/sshd_config
Port 22
Port 1022
2.重启sshd服务
systemctl restart sshd
3.查看服务启动情况
netstat -lntp |
4.防火墙放行
iptables -A INPUT -p tcp --dport 1022 -j ACCEPT |
5.使用xshell等连接即可
可以同时使用22及1022的端口进行sshd连接服务器了
Spring Boot 的核心注解SpringBootApplication引起的探究
星期二, 2019-12-03 | Author: Lee | JAVA-and-J2EE, spring-boot | 没有评论 393 views
Spring Boot 的核心注解SpringBootApplication引起的探究
1.Spring Boot 的核心注解是哪个?
先上一个工程的启动配置项看下:
项目比较老混杂了spring boot,dubbo,jersey注册等
package com.pomelolee.cms; import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig; import com.pomelolee.boot.dubbo.annotation.EnableDubboProvider; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletProperties; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.netflix.feign.EnableFeignClients; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; import org.springframework.context.annotation.ImportResource; import org.springframework.util.ClassUtils; import java.util.HashSet; import java.util.Set; @EnableFeignClients @SpringBootApplication @EnableApolloConfig @EnableDiscoveryClient @EnableDubboProvider @ImportResource("classpath*:/META-INF/spring/spring-job.xml") public class Application extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } @Bean public ResourceConfig resourceConfig() { ResourceConfig resourceConfig = new ResourceConfig(); ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(true); Set<beandefinition> beanDefinitionSet = scanner.findCandidateComponents("com.pomelolee.cms.service"); beanDefinitionSet.addAll(scanner.findCandidateComponents("com.pomelolee.cms.facade")); beanDefinitionSet.addAll(scanner.findCandidateComponents("com.pomelolee.cms.config")); Set<Class<?>> clazzSet = new HashSet<Class<?>>(); for (BeanDefinition beanDefinition : beanDefinitionSet) { clazzSet.add( ClassUtils.resolveClassName( beanDefinition.getBeanClassName(), resourceConfig.getClassLoader())); } resourceConfig.registerClasses(clazzSet); resourceConfig.property(ServletProperties.FILTER_FORWARD_ON_404, true); return resourceConfig; } } </beandefinition> |
@SpringBootApplication 注解,就是 Spring Boot 的核心注解。
centos下jdk11及jdk8的环境变量配置
星期三, 2019-11-20 | Author: Lee | JAVA-and-J2EE, linux | 没有评论 1,025 views
0.最新的下载地址
Oracle 官方下载地址:https://www.oracle.com/technetwork/java/javase/downloads/index.html
国内镜像仓库华为:https://repo.huaweicloud.com/java/jdk/
由于Oracle JDK 11 的许可证的变化,生产环境需要使用OpenJDK 11(以免甲骨文律师信警告^o^)
亚马逊的编译版本下载地址(corretto):https://aws.amazon.com/cn/corretto/
adoptopenjdk编译的版本下载:https://adoptopenjdk.net/
1.配置jdk11、jdk12的 /etc/profile文件最后面追加即可,
jdk9后续版本将不再有jre及classpath要配置了
vi /etc/profile export JAVA_HOME=/usr/local/webserver/jdk/jdk-11.0.5 export PATH=$PATH:$JAVA_HOME/bin |
后续source 生效
source /etc/profile java -version |
2.配置jdk8的配置文件
tar zxvf jdk-8u231-linux-x64.tar.gz mv jdk1.8.0_231 /usr/local/java/ vi /etc/profile export JAVA_HOME=/usr/local/java/jdk1.8.0_231 export JRE_HOME=/usr/local/java/jdk1.8.0_231/jre export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JRE_HOME/lib export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin |
golang开发环境快速搭建centos版本
星期二, 2019-11-12 | Author: Lee | golang | 没有评论 495 views
1.用golang写过一些工具,每次要开发工具的时候还要去弄下对应的环境,记录下,好随时翻阅
这里使用的是centos8,window版本直接配置即可
2.官网下载二进制安装包,现在有国内可以访问的地址了
wget https://dl.google.com/go/go1.13.4.linux-amd64.tar.gz mkdir -p /usr/local/golang/opt/ tar -C /usr/local/golang/opt/ -zxvf go1.13.4.linux-amd64.tar.gz mkdir -p /usr/local/golang/repos/gopath/ |
3.设置环境变量填写如下地址
vi /etc/profile export GOROOT=/usr/local/golang/opt/go export GOPATH=/usr/local/golang/repos/gopath export PATH=$PATH:$GOROOT/bin source /etc/profile go version |
4.编写hello.go文件测试
cd /usr/local/golang/repos/gopath vi hello.go package main import "fmt" func main(){ fmt.Printf("hello,world\n"); } |
5.运行及编译
go run hello.go go build hello.go ./hello |
6.解决不翻墙go get之类的net包问题
mkdir -p $GOPATH/src/golang.org/x/ cd $GOPATH/src/golang.org/x/ yum install git git clone https://github.com/golang/net.git net go install net |
执行go install之后没有提示,就说明安装好了。
7.后续就各种api 开发吧
https://golang.google.cn/doc/
centos8的最小化安装及更换yum地址
星期二, 2019-11-12 | Author: Lee | linux | 没有评论 1,225 views
1.centos8的下载地址
http://isoredirect.centos.org/centos/8/isos/x86_64/
选择CentOS-8-x86_64-1905-boot.iso下载这个比较小只有500M多点
DVD版本太大了6.6G的样子,想安装省事可以直接下载这个CentOS-8-x86_64-1905-dvd1.iso 版本
2.这里选择是阿里云的下载地址
centos8用于网络安装的镜像文件 https://mirrors.aliyun.com/centos/8/isos/x86_64/CentOS-8-x86_64-1905-boot.iso 534M
完整安装包要 6.64G https://mirrors.aliyun.com/centos/8/isos/x86_64/CentOS-8-x86_64-1905-dvd1.iso
3.安装界面先配置下网络点选下即可,主要是配置安装源 如下图配置即可
网络地址填写下面即可:http://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/
4.后续安装就等待即可,设置下root和账号密码等
5.更新yum源头及安装下网络工具
yum install net-tools |
可以使用 netstat -lntp工具了
cd /etc/yum.repos.d vi CentOS-Base.repo ## 修改为如下内容 CentOS-Base.repo [BaseOS] name=CentOS-$releasever - Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/ baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial vi CentOS-AppStream.repo ## CentOS-AppStream.repo [AppStream] name=CentOS-$releasever - AppStream #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/ baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial yum makecache |
使用shell脚本批量发送curl的POST数据请求
星期五, 2019-10-18 | Author: Lee | JAVA-and-J2EE, linux | 没有评论 1,780 views
里面写了sleep睡眠,可以移除
写定循环传递参数等,用于自动处理数据比较方便,记录如下,可以根据自己的情况进行调整.
shell脚本如下
#!/bin/bash function curlRequest() { echo ">>>>>>>>>>>>>>"$1 info=`curl -s -H "Accept: application/json" -H "Content-type: application/json" -X POST -d "{\"id\":$1,\"processState\":3}" "https://www.pomelolee.com/info" ` echo "<<<<<<<<<<<<<<"$info #info=`curl -s -m 10 --connect-timeout 10 -I $1` #code=`echo $info|grep "HTTP"|awk '{print $2}'` #if [ "$code" == "200" ];then # echo "request succeed,ret code is $code" #else # echo "request fail,ret code is $code" #fi } ids=(29 100 13 8 91 44) for id in ${ids[@]} do curlRequest $id echo $id sleep 2s done |
Search
相关文章
热门文章
最新文章
文章分类
- ajax (9)
- algorithm-learn (2)
- Android (6)
- as (3)
- computer (54)
- Database (29)
- disucz (4)
- enterprise (1)
- erlang (2)
- flash (4)
- golang (3)
- html5 (18)
- ios (4)
- JAVA-and-J2EE (158)
- linux (121)
- mac (6)
- movie-music (11)
- pagemaker (35)
- php (49)
- spring-boot (2)
- Synology群晖 (2)
- Uncategorized (6)
- unity (1)
- webgame (15)
- wordpress (33)
- work-other (1)
- 体味生活 (40)
- 大数据 (4)
- 游戏开发 (9)
- 爱上海 (19)
- 读书 (4)
- 软件 (3)