Skip to content

Instantly share code, notes, and snippets.

View leon0516's full-sized avatar

leon leon0516

View GitHub Profile
@leon0516
leon0516 / .xprofile
Created June 1, 2017 11:32
manjaro fcitx 输入法设置,在home里.profile文件中添加以下内容
export XIM_PROGRAM=fcitx
export XIM=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS="@im=fcitx"
@leon0516
leon0516 / .vimrc
Created June 1, 2017 06:44
vim 配置
set nocompatible " be iMproved, required
filetype off " required
syntax on
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
set laststatus=2
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
@leon0516
leon0516 / agnoster.zsh-theme
Created May 27, 2017 04:14
安装 zsh 和 oh my zsh 安装 https://github.com/ryanoasis/nerd-fonts字体 分别在root和普通用户.zshrc文件中 export DEFAULT_USER 变量,值一个是root一个是普通用户名,可以吧XXX@hostmane隐去
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
#
@leon0516
leon0516 / Sample.java
Last active May 23, 2017 03:05
百度语音转文字restful接口示例 文档地址 https://cloud.baidu.com/doc/SPEECH/ASR-API.html#.E7.AE.80.E4.BB.8B
public class Sample {
private static final String serverURL = "http://vop.baidu.com/server_api";
private static String token = "";
private static final String testFileName = "test.pcm";
//put your own params here
private static final String apiKey = "";
private static final String secretKey = "";
private static final String cuid = "";
@leon0516
leon0516 / Base64.md
Last active April 9, 2017 02:12 — forked from barrysteyn/Base64.md
OpenSSL Base64 En/Decode: Portable and binary safe.

OpenSSL Base64 Encoding: Binary Safe and Portable

Herewith is an example of encoding to and from base64 using OpenSSL's C library. Code presented here is both binary safe, and portable (i.e. it should work on any Posix compliant system e.g. FreeBSD and Linux).

License

The MIT License (MIT)

Copyright (c) 2013 Barry Steyn

# 2017-04-17 15:39
[General]
bypass-system = true
skip-proxy = 192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,localhost,*.local,e.crashlynatics.com,captive.apple.com,*.12306.cn,a.nuist.edu.cn
bypass-tun = 10.0.0.0/8,100.64.0.0/10,127.0.0.0/8,169.254.0.0/16,172.16.0.0/12,192.0.0.0/24,192.0.2.0/24,192.88.99.0/24,192.168.0.0/16,198.18.0.0/15,198.51.100.0/24,203.0.113.0/24,224.0.0.0/4,255.255.255.255/32
dns-server = 119.29.29.29,223.5.5.5,8.8.8.8,223.6.6.6
[Host]
api.smoot.apple.com.cn = api.smoot.apple.com
onedrive.live.com = 134.170.108.26
@leon0516
leon0516 / Get_Out_Spam.sh
Created January 31, 2017 02:05
CentOS上封邮件发出实现防SPAM和BT、PT
#!/bin/bash
#########################################################################
# File Name: Get_Out_Spam.sh
# Author: LookBack
# Email: admin#dwhd.org
# Version:
# Created Time: 2015年09月15日 星期二 22时30分38秒
#########################################################################
smpt_port="25,26,465,587"
@leon0516
leon0516 / auto_firewall.sh
Created January 27, 2017 16:04
centos 7.0+ 自动放行firewall端口脚本//需手动后台运行
#!/bin/bash
echo "---------------------------------------------------------"
echo "Script is Running ......................................."
echo "---------------------------------------------------------"
logfile=log.txt
#Script run between time
sleep_time=30
is_need_run_firewall_cmd=false
echo "`date '+%Y-%m-%d %H:%M:%S'` INFO: service start!" >> $logfile
@leon0516
leon0516 / BubbleSort.java
Last active November 29, 2016 05:52
排序算法 交换数组 整理自网络
public class BubbleSort {
/**
* 最优冒泡排序
* 如果有100个数的数组,仅前面10个无序,后面90个都已排好序且都大于前面10个数字,
* 那么在第一趟遍历后,最后发生交换的位置必定小于10,
* 且这个位置之后的数据必定已经有序了,记录下这位置,
* 第二次只要从数组头部遍历到这个位置就可以了。
*/
void BubbleSort(int a[], int n) {
@leon0516
leon0516 / BytesUtil.java
Created November 28, 2016 15:17
java Byte 处理
public class BytesUtil {
/**
* Convert byte[] to hex string. 把字节数组转化为字符串
* 这里我们可以将byte转换成int,然后利用Integer.toHexString(int)来转换成16进制字符串。
* @param src byte[] data
* @return hex string
*/
public static String bytesToHexString(byte[] src){
StringBuilder stringBuilder = new StringBuilder("");
if (src == null || src.length <= 0) {