Skip to content

Instantly share code, notes, and snippets.

@feiandxs
feiandxs / Block Baidu Hosts
Created January 11, 2016 05:21 — forked from nerdroychan/No Baidu
Block Baidu Hosts
##
# Block Baidu
##
127.0.0.1 baidu.com
127.0.0.1 www.baidu.com
127.0.0.1 pan.baidu.com
127.0.0.1 post-js.baidu.com
127.0.0.1 bbs.baidu.com
127.0.0.1 tieba.baidu.com
127.0.0.1 wapp.baidu.com
#114dns
114.114.114.114
114.114.115.115
#alibaba.public.dns
223.5.5.5
223.6.6.6
#baidu.public.dns
180.76.76.76
#dnspod.tencent.public.dns
119.29.29.29
@feiandxs
feiandxs / gist:8a493b42bb97df72b227cc46cbc1807b
Last active January 28, 2018 08:58
set static ip address for ubuntu 16.04
auto enp7s0
iface enp7s0 inet static
address 10.0.208.222
netmask 255.255.240.0
gateway 10.0.208.1
dns-nameservers 10.0.208.1
#enp7s0 = name
#给 Ubuntu 16.04 系统设置静态 IP 地址
https://press.one/p/address/v?s=49bca4a86f2aee5d7ba3c0bf4f5f8e12a23e34db6c5bba9f960a3cfc9696bc4aa6224540f6b6dcec73d514fc3bbace73cf0c5dbd6bd4e954287c8a049a636fd00&h=4c3a3a251e2d22ba49efbafd3cae14d35aea925ccdf4d9b6fe4c331f7d4637ec&a=96a691401ac07772f32dd43fe0c6fcda97a13df1&f=P1&v=2
@feiandxs
feiandxs / install.sh
Created July 30, 2019 06:21
install jenkins by yum on centos 7
#!/bin/bash
#Jenkins is a Java application, so the first step is to install Java. Run the following command to install the OpenJDK 8 package:
sudo yum install java-1.8.0-openjdk-devel
#The next step is to enable the Jenkins repository. To do that, import the GPG key using the following curl command:
curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo
#And add the repository to your system with:
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
#sudo yum install jenkins
sudo yum install jenkins
@feiandxs
feiandxs / bbc-13-minutes-to-the-moon.markdown
Created April 9, 2020 10:41
BBC - 13 Minutes to the Moon
@feiandxs
feiandxs / fix-wordpress-https-301.php
Created July 6, 2020 03:33
WordPress启用https后首页无限301跳转问题的解
// 添加在wp-config.php的文件开头
$_SERVER['HTTPS'] = 'on';
define('FORCE_SSL_LOGIN', true);
define('FORCE_SSL_ADMIN', true);
@feiandxs
feiandxs / reporter.sh
Created February 1, 2021 05:42 — forked from archichen/reporter.sh
一行命令生成所有占用端口及其进程报告|Generate a report for all occupied port and their program with a line command
# Choose one command, Copy it and execute, no need for execute reporter.sh file.
# Report file was place at /tmp/reporter.csv|md
# CSV version
# Preview: https://imgur.com/c5E0T1v
netstat -ntlp | awk 'BEGIN{ system("echo IP, Port, PID, Parameter > /tmp/reporter.csv") } NR>2 {if($4 !~ "::" && $7 != "-"){split($4,ipAndPort,":"); split($7,pidAndProgress,"/"); system("echo "ipAndPort[1]","ipAndPort[2]","pidAndProgress[1]", `cat /proc/"pidAndProgress[1]"/cmdline` >> /tmp/reporter.csv")}}'
# Markdown version
# Preview: https://imgur.com/ivmUhgu
netstat -ntlp | awk 'BEGIN{ system("echo \\|IP\\|Port\\|PID\\|Parameter\\| > /tmp/reporter.md; echo \\|-\\|-\\|-\\|-\\| >> /tmp/reporter.md") } NR>2 {if($4 !~ "::" && $7 != "-"){split($4,ipAndPort,":"); split($7,pidAndProgress,"/"); system("echo \\|"ipAndPort[1]"\\|"ipAndPort[2]"\\|"pidAndProgress[1]"\\|`cat /proc/"pidAndProgress[1]"/cmdline`\\| >> /tmp/reporter.md")}}'
@feiandxs
feiandxs / fastapi_export_xls.py
Created August 16, 2021 05:33
fastapi输出xls 下载
from fastapi import FastAPI
from fastapi.responses import Response
import xlwt
from io import BytesIO
app = FastAPI()
@app.get("/")
@feiandxs
feiandxs / ffmpeg-commands-list.md
Last active June 15, 2022 03:04
FFmpeg commands

There are too many ffmpeg parameters, but there is no need to remember them.

Use 'convert FormatA to FormatB' to search.

convert jpeg to gif

ffmpeg -i A.jpeg A.gif

convert png to gif