Skip to content

Instantly share code, notes, and snippets.

View Sailfishc's full-sized avatar
🎯
Focusing

张成 Sailfishc

🎯
Focusing
View GitHub Profile
@Sailfishc
Sailfishc / idcardUtils.java
Created August 7, 2018 06:39 — forked from 5ZSQ/idcardUtils.java
中国公民身份证验证 - java
/**
* Copyright (C) 2009-2010 Yichuan, Fuchun All rights reserved.
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
@Sailfishc
Sailfishc / maven-shade-plugin.pom.xml
Created December 28, 2018 03:04 — forked from yangl/maven-shade-plugin.pom.xml
maven-shade-plugin把强依赖的jar包更改包名并一起打包到自己的jar中,防止依赖冲突,中件间团队必会淫技!http://maven.apache.org/plugins/maven-shade-plugin/index.html
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
@Sailfishc
Sailfishc / github_multiple-accounts.md
Created March 15, 2019 05:03 — forked from hellokaton/github_multiple-accounts.md
How to Work with GitHub and Multiple Accounts

Step 1 - Create a New SSH Key

We need to generate a unique SSH key for our second GitHub account.

ssh-keygen -t rsa -C "your-email-address"

Be careful that you don't over-write your existing key for your personal account. Instead, when prompted, save the file as id_rsa_COMPANY. In my case, I've saved the file to ~/.ssh/id_rsa_work.

Step 2 - Attach the New Key

安装 BBR

wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/bbr.sh && chmod +x bbr.sh && bash bbr.sh

使用方法

# 启动BBR
@Sailfishc
Sailfishc / aria2_oneindex.md
Created March 15, 2019 05:05 — forked from hellokaton/aria2_oneindex.md
Aria2 + OneIndex 自动上传打造离线网盘

Aria2 + OneIndex 自动上传打造离线网盘

5ba334a75cd12

1. 安装 Nginx + PHP

yum -y install wget screen curl python git
wget http://mirrors.linuxeye.com/lnmp-full.tar.gz
tar xzf lnmp-full.tar.gz
@Sailfishc
Sailfishc / UrlShortener.java
Created March 15, 2019 05:06 — forked from hellokaton/UrlShortener.java
Java 短链接生成算法
public class UrlShortener {
// private static final String ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
private static final String ALPHABET = "mUSNcOa6hDgfnEJ1rGMPC03jv4k9RIqL2Yy7TQdH8xu5XFWwAKoZVstizlepBb";
private static final int BASE = ALPHABET.length();
public static String encode(int num) {
StringBuilder sb = new StringBuilder();
while (num > 0) {
sb.append(ALPHABET.charAt(num % BASE));
@Sailfishc
Sailfishc / mysql_back.sh
Created March 15, 2019 05:07 — forked from hellokaton/mysql_back.sh
在 Linux 上定时备份 MySQL 数据库,并发送备份到邮件
#!/bin/sh
#this is the prefix before the filename and can be anything you want
fileprefix='mysql_backup_';
#this is your mysql user - best to create a new mysql user called backup that has access to all databases
myuser='backup';
#your mysql password
mypass='s0mething$ecure123';
@Sailfishc
Sailfishc / ImageUtil.java
Created March 15, 2019 05:08 — forked from hellokaton/ImageUtil.java
图片压缩工具类
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
@Sailfishc
Sailfishc / git_upstream.md
Created March 15, 2019 05:08 — forked from hellokaton/git_upstream.md
保持fork之后的项目和上游同步

开源协作,为了规范,一般都是 fork 别人的仓库到自己帐号下,再提交pr,原始仓库一直保持更新,下面介绍如何保持自己fork之后的仓库与上游仓库同步。

下面以我 fork Blade 仓库为例

点击 fork 到自己帐号下,然后就可以在自己的帐号下 clone 相应的仓库

使用 git remote -v 查看当前的远程仓库地址,输出如下:

origin git@github.com:biezhi/blade.git (fetch)