Skip to content

Instantly share code, notes, and snippets.

View trydofor's full-sized avatar
🖖
may the force be with you

trydofor

🖖
may the force be with you
View GitHub Profile
@trydofor
trydofor / jekyll-docker.sh
Created March 27, 2019 23:58
通过docker运行jekyll,以免搞乱系统 #docker #shell #blog
#!/bin/bash
# https://hub.docker.com/r/bretfisher/jekyll-serve
path = $(pwd)
name = $(basename $path)
echo visit http://0.0.0.0:4000
docker ps - a | grep $name
case "$1" in
init)
echo $name creating...
docker run \
@trydofor
trydofor / RuntimeConf.sh
Created March 8, 2019 11:01
日志监控配置-钉钉
## this conf value will be replaced by sub-conf ##
NOTICE_PROC(){
confname=$1
textfile=$2
scp $textfile ubuntu@jiayu-release:/data/staticweb/procerr/log/ && rm -rf $textfile
cnt="1"
if [ -f "$path_data/COUNT-$1" ]; then
cnt=`cat $path_data/COUNT-$1`
cnt=$((cnt + 1))
@trydofor
trydofor / RuntimeConf.sh
Created March 5, 2019 04:10
通常日志和程序监控
#!/bin/bash
#######################################
##RuntimeConf.sh
#NOTICE_PROC(){
# echo $MAIL_SUBJ
# echo $MAIL_TO
# echo $1
# echo $2
#}
#
@trydofor
trydofor / dingding.sh
Created March 5, 2019 01:32
dingding-notice
# 钉钉提醒
curl 'https://oapi.dingtalk.com/robot/send?access_token=xxxxx' \
-H 'Content-Type: application/json' \
-d '
{
"msgtype": "text",
"text": {
"content": "'"$domain"' 将在 '"$expiry_days"' 后过期,务必手动更新证书 "
},
"at": {
@trydofor
trydofor / java-tips-1
Created October 25, 2018 02:28
little tips
// 输出10位数字,左填充 0000000199
int count = 199;
// 字符串填充,10个'0'
String s1 = "0000000000" + count;
System.out.println(s1.substring(s1.length() - 10));
// 19位以下,数字填充
String s2 = String.valueOf(10_000_000_000L + count);
System.out.println(s2.substring(1));
@trydofor
trydofor / mvn-deploy-pom.sh
Created September 15, 2018 05:25
deploy local repo to nexus
#!/bin/bash
#https://support.sonatype.com/hc/en-us/articles/115006744008
repoId="nexus-jiayu"
repoUrl="http://maven.jiayuinc.com/repository/devops/"
tempDir="/tmp/"
function deploy_pom(){
pom=$1
ext=$(grep packaging $pom | sed -E 's/^.*>(.*)<.*$/\1/g')
@trydofor
trydofor / mysql-214-ubuntu
Created May 7, 2018 09:25
Ubuntu – mysql 5.6 – max connections 214
# append to [Service]
sudo tee -a /lib/systemd/system/mysql.service << EOF
LimitNOFILE=infinity
LimitMEMLOCK=infinity
EOF
sudo systemctl daemon-reload
sudo service mysql restart
@trydofor
trydofor / rsync-files.sh
Created April 23, 2018 06:11
判断主机和程序,rsync目录
#!/bin/bash
master_host=jiayu-app-master
master_ip=`grep $master_host /etc/hosts | awk '{print $1}'`
master_here=`ifconfig -a | grep $master_ip`
this_host=""
that_host=""
if [ -z "$master_here" ]; then
@trydofor
trydofor / new_file0
Created March 17, 2018 09:07
wet oracle-jdk-1.8_162
wget --tries=3 --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u162-b12/0da788060d494f5095bf8624735fa2f1/jdk-8u162-linux-x64.tar.gz -O ./jdk-8u162-linux-x64.tar.gz
@trydofor
trydofor / virtualbox-hostonly-ubuntu-16.04
Last active February 20, 2018 09:26
virtualbox ubuntu 16.04
# host
sudo iptables -t nat -A POSTROUTING -s 192.168.56.0/24 -j MASQUERADE
# guest
sudo vi /etc/network/interfaces
auto enp0s3