Skip to content

Instantly share code, notes, and snippets.

Avatar

刘兵 iflamed

View GitHub Profile
@iflamed
iflamed / .drone.yml
Last active Oct 11, 2021
Drone CI: git clone with ssh in the clone step
View .drone.yml
---
kind: pipeline
type: docker
name: default
clone:
disable: true
steps:
- name: clone
@iflamed
iflamed / hostip.sh
Created Jun 14, 2021
获取linux/mac 主机IP地址
View hostip.sh
ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v 169.254|grep -v 0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:" | head -n 1
@iflamed
iflamed / redis-key-delete-batch.sh
Created Jan 16, 2021
批量删除redis中的key
View redis-key-delete-batch.sh
redis-cli -h host -a password --scan --pattern 'Name\\Path\\Value\\Patte*rn' | sed 's/\\/\\\\/g' | xargs redis-cli -h host -a password del
@iflamed
iflamed / iptables-cloud-ip.sh
Created Jan 16, 2021
ECS 通过 iptables SNAT转发 共享一个IP上网
View iptables-cloud-ip.sh
# 背景:
> 有一台A服务器不能上网,和B服务器通过内网来连接,B服务器可以上网,要实现A服务器也可以上网。
内网主机: A eth1:172.16.1.8
外网主机: B eth0:10.0.0.6 外网主机: B eth1:172.16.1.6
SNAT:改变数据包的源地址。防火墙会使用外部地址,替换数据包的本地网络地址。这样使网络内部主机能够与网络外部通信。
## 在可以上网那台服务器B上,开启内核路由转发功能
### 临时
@iflamed
iflamed / compress-video.sh
Created Feb 1, 2020
compress mp4 format video
View compress-video.sh
for f in *.mp4;
do
ffmpeg -i "$f" -vcodec libx264 -crf 28 cpmmp4/"${f%.mp4}".mp4
done
@iflamed
iflamed / hostname.sh
Created Apr 19, 2019
centos7 change hostname
View hostname.sh
hostnamectl --static set-hostname qqmm
@iflamed
iflamed / optimize-table.sql
Created Mar 10, 2019
数据表碎片优化
View optimize-table.sql
select concat('optimize table ',table_schema,'.',table_name,';'),data_free,engine
from information_schema.tables
where data_free>0 and engine !='MEMORY'
ORDER BY data_free DESC ;
@iflamed
iflamed / iptables-forword.md
Last active Oct 30, 2018
iptables 端口转发、中继上网
View iptables-forword.md

开启防火墙的ipv4转发

echo -e "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
sysctl -p

配置iptables开机加载

首先我们设置一下iptables 防火墙的开机启动自动载入规则功能。

@iflamed
iflamed / deploy.php
Created Oct 16, 2018 — forked from martincarlin87/deploy.php
Deployer Laravel 5
View deploy.php
<?php
namespace Deployer;
require 'recipe/laravel.php';
$repo_url = '';
$branch = 'master';
$server_url = '';
$user = '';
@iflamed
iflamed / beanstalkd.service
Created Sep 16, 2015
Beanstalkd Centos 7 systemctl config file
View beanstalkd.service
# beanstalkd
Beanstalkd Centos 7
http://stackoverflow.com/questions/26786368/beanstalkd-for-centos-7?answertab=active#tab-top
Yes, you can instal it via git and then copy systemd script:
**Step 0. Install git**
` yum install git `