Skip to content

Instantly share code, notes, and snippets.

View fankay's full-sized avatar
🚀
loading...

fankay

🚀
loading...
  • kaishengit
  • China.Jiaozuo
  • X @fankay
View GitHub Profile
@fankay
fankay / DeadLock.java
Created January 12, 2018 02:20
多线程死锁演示
package com.kaishengit.ppt;
public class DeadLock {
private Object lockA = new Object();
private Object lockB = new Object();
public void deadLock() {
Thread threadA = new Thread(new Runnable() {
@Override
@fankay
fankay / Test.java
Created January 10, 2018 06:45
演示ThreadLocal的使用
package com.kaishengit.ppt;
public class Test {
public static void main(String[] args) throws InterruptedException {
User user = new User();
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
user.setName("Jcak");
@fankay
fankay / BlockList.java
Created January 10, 2018 06:21
通过创建自定义阻塞集合演示线程中的Lock接口以及Condition类的使用
package com.kaishengit.ppt;
import java.util.LinkedList;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class BlockList<T> {
@fankay
fankay / BlockList.java
Created January 10, 2018 02:54
通过创建自定义阻塞集合演示线程中的wait方法以及notify方法的使用
package com.kaishengit.ppt;
import java.util.LinkedList;
import java.util.concurrent.atomic.AtomicInteger;
public class BlockList<T> {
private LinkedList<T> linkedList = new LinkedList<>();
private int minSize = 0;
private int maxSize;
@fankay
fankay / emojis.json
Created December 20, 2017 01:36 — forked from oliveratgithub/emojis.json
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family_mothers_two_girls", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family_mothers_children", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family_mothers_two_boys", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128102;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family_two_girls", "shortname": "", "unicode": "", "html": "&#128104;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👦", "name": "family_children", "shortname": "", "unicode": "", "html": "&#128104;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👦‍👦", "name": "family_two_boys", "shortname": "", "unicode": "", "html": "&#128104;&zw
@fankay
fankay / 00-intro.md
Created December 20, 2016 05:35 — forked from mdo/00-intro.md
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.

Ikea Bekant standing desk with Gerton table top

git branch
git checkout
git checkout -b
git merge
@fankay
fankay / FlashScopeFilter.java
Created September 24, 2014 03:05
使用 Filter实现 FlashAttribute
package com.kaishengit.web.filter;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
@fankay
fankay / gist:10275667
Created April 9, 2014 14:17
利用RandomAccessFile类将一个文件分割为多个文件(图片)
//分割
public static void splitFile(String path,int count) {
try {
RandomAccessFile raf = new RandomAccessFile(path, "r");
//文件总大小
long length = raf.length();
//每份文件大小
long maxSize = length / count;
//最后一份文件大小