Skip to content

Instantly share code, notes, and snippets.

View hangox's full-sized avatar
🤒
Out sick

hangox

🤒
Out sick
View GitHub Profile
@hangox
hangox / init-docker-and-bbr
Created August 9, 2020 14:00
初始化主机
#!/usr/bin/env bash
curl -o- -L https://gist.githubusercontent.com/hangox/1b7c6b1e675cba36e654e5d9f546085d/raw/4e416c709187f914a919e6f6a9ba22fcd611cf74/enable-bbr.sh | bash
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update -y
sudo apt-get install -y\
apt-transport-https \
ca-certificates \
curl \
@hangox
hangox / ubunut-install-docker.sh
Last active April 11, 2023 08:17
ubuntu 安装docker
#!/usr/bin/env bash
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update -y
sudo apt-get install -y\
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
@hangox
hangox / license_accepter.sh
Created March 11, 2018 05:54
make adk license
#!/bin/bash
ANDROID_HOME=$1
check_android_home() {
if [ "$#" -lt 1 ]; then
if [ -z "${ANDROID_HOME}" ]; then
echo "Please either set ANDROID_HOME environment variable, or pass ANDROID_HOME directory as a parameter"
exit 1
else
ANDROID_HOME="${ANDROID_HOME}"
@hangox
hangox / enable-bbr.sh
Last active May 25, 2018 10:58
打开bbr
#!/usr/bin/env bash
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
sysctl net.ipv4.tcp_available_congestion_control
sysctl net.ipv4.tcp_congestion_control
lsmod | grep bbr
@hangox
hangox / update-kernel-for-centos7.sh
Last active October 11, 2017 07:29
更换cento7 的内核
#!/usr/bin/env bash
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
yum --enablerepo=elrepo-kernel install kernel-ml -y
egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'
grub2-set-default 0 # default 0 表示第一个内核设置为默认运行, 选择最新内核就对了
reboot
@hangox
hangox / install-docker-ce-for-centos7.sh
Last active October 17, 2017 05:54
安装docker-ce
#!/usr/bin/env bash
# 移除老旧docker
sudo yum remove docker \
docker-common \
docker-selinux \
docker-engine
sudo yum install -y yum-utils \
@hangox
hangox / Git打包
Last active May 25, 2018 02:59
Git打包命令
简单的用法就是
git archive --format zip --output /path/to/file.zip master # 将 master 以zip格式打包到指定文件
还有个更简单的
git archive v0.1 | gzip > site.tgz
git archive master > /home/hainuo/fds.zip
@hangox
hangox / push_nexus.gradle
Last active September 20, 2016 07:21
一个发布到nexus 的脚本
apply plugin: 'com.bmuschko.nexus'
//buidscript 中添加 classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
//version = '1.1'
//group = 'com.hangox'
//ext{
// libName = 'RulerView'
// libDescripton = '刻度尺'
//}
modifyPom {
@hangox
hangox / MainActivity.java
Created July 17, 2015 01:51
更改5.0statusbar 为透明颜色
View statusBar = getWindow().getDecorView().findViewById(android.R.id
.statusBarBackground);
statusBar.setBackgroundResource(android.R.color.transparent);
@hangox
hangox / Dp2px
Created April 11, 2015 10:13
一个Android中dp2px代码
public static int dpToPx(Context context,float dpValue) {
final float scale =context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}