Skip to content

Instantly share code, notes, and snippets.

View hellokaton's full-sized avatar
:shipit:
Focusing on work

見える hellokaton

:shipit:
Focusing on work
View GitHub Profile
@hellokaton
hellokaton / mysql隔离级别及事务传播
Created February 17, 2016 10:35 — forked from JagoWang/mysql隔离级别及事务传播
mysql隔离级别及事务传播
TRANSACTION(事务隔离级别)
1. ISOLATION_DEFAULT:这是一个PlatfromTransactionManager默认的隔离级别,使用数据库默认的事务隔离级别。
每种数据库的默认隔离级别是不同的,例如SQL Server、Oracle默认Read Commited,MySQL默认Repeatable Read。
另外四个与JDBC的隔离级别相对应,不同的隔离级别采用不同的锁类型来实现,在四种隔离级别中,Serializable的
隔离级别最高,Read Uncommited的隔离级别最低。
2. ISOLATION_READ_UNCOMMITTED:读未提交数据,这是事务最低的隔离级别,在并发的事务中,它充许一个事务可以
读到另一个事务未提交的更新数据。(会出现脏读,不可重复读和幻读)
3. ISOLATION_READ_COMMITTED:读已提交数据,保证在并发的事务中,一个事务修改的数据提交后才能被另外一个事
@hellokaton
hellokaton / Emoji.java
Created April 19, 2016 10:15 — forked from Buttonwood/Emoji.java
表情字符判断
/**
* 判断一个字符是否emoji表情字符
*
* @param ch
* 待检测的字符
*/
public static boolean isEmoji(char ch) {
return !((ch == 0x0) || (ch == 0x9) || (ch == 0xA) || (ch == 0xD)
|| ((ch >= 0x20) && (ch <= 0xD7FF))
|| ((ch >= 0xE000) && (ch <= 0xFFFD)) || ((ch >= 0x10000) && (ch <= 0x10FFFF)));
@hellokaton
hellokaton / reddit_hot_sortAlgorithm_analysis.md
Created April 20, 2016 14:40
Reddit 最新热度排名算法分析

#source code

cdef extern from "math.h":
    double log10(double)
    double sqrt(double)

epoch = datetime(1970, 1, 1, tzinfo = g.tz)

cpdef double epoch_seconds(date):
@hellokaton
hellokaton / TopicRank.java
Created April 20, 2016 14:48
Java排名算法
import blade.kit.DateKit;
public class TopicRank {
/**
* 计算帖子权重
* @param stars 点赞数
* @param comments 评论数
* @param sink 下沉数
* @param create 创建时间
@hellokaton
hellokaton / Base64.java
Created April 25, 2016 06:45
java base64
import java.io.UnsupportedEncodingException;
public class Base64 {
private static char[] base64EncodeChars = new char[] { 'A', 'B', 'C', 'D',
'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',
'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '+', '/' };
@hellokaton
hellokaton / DefaultCommentGenerator.java
Last active June 28, 2016 10:11
修改mybaties生成器注释代码
/*
* Copyright 2008 The Apache Software Foundation
*
* Licensed 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
@hellokaton
hellokaton / fix-homebrew-npm.md
Created August 20, 2016 11:28 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

@hellokaton
hellokaton / donate-buttons.htm
Created September 1, 2016 14:35 — forked from solicomo/donate-buttons.htm
精简过的PayPal捐赠按钮和OKPay捐赠按钮。前者是基于“立即购买”按钮修改的,因为中国的PayPal账户不能接收捐赠。
<center>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="soli@cbug.org">
<input type="hidden" name="item_name" value="Support cbug.org">
<input type="hidden" name="amount" value="">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" style="border:0px;background:none;" name="submit" alt="PayPal - The safer, easier way to pay online">
</form>
</center>
@hellokaton
hellokaton / git_cmd.md
Last active May 7, 2017 05:19
git常用命令

把本地的dev分支强制(-f)推送到远程master

git push origin dev:master -f

删除远程分支

BufferedImage image = new BufferedImage(144, 32, BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
g.setFont(new Font("Dialog", Font.PLAIN, 24));
Graphics2D graphics = (Graphics2D) g;
graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
graphics.drawString("Hello World!", 6, 24);
ImageIO.write(image, "png", new File("text.png"));
for (int y = 0; y < 32; y++) {