Skip to content

Instantly share code, notes, and snippets.

View pkpk1234's full-sized avatar

pkpk1234 pkpk1234

View GitHub Profile
@pkpk1234
pkpk1234 / ObjectHeader32.txt
Created January 7, 2020 01:43 — forked from arturmkrtchyan/ObjectHeader32.txt
Java Object Header
|----------------------------------------------------------------------------------------|--------------------|
| Object Header (64 bits) | State |
|-------------------------------------------------------|--------------------------------|--------------------|
| Mark Word (32 bits) | Klass Word (32 bits) | |
|-------------------------------------------------------|--------------------------------|--------------------|
| identity_hashcode:25 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Normal |
|-------------------------------------------------------|--------------------------------|--------------------|
| thread:23 | epoch:2 | age:4 | biased_lock:1 | lock:2 | OOP to metadata object | Biased |
|-------------------------------------------------------|--------------------------------|--------------------|
|
@pkpk1234
pkpk1234 / settings.xml
Created May 19, 2017 02:45
maven no https repo config
<settings>
... ...
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>securecentral</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>securecentral</id>
<!--Override the repository (and pluginRepository) "central" from the
@pkpk1234
pkpk1234 / HeapSort
Last active May 18, 2017 09:23
Sorts
package com.ljm.sorts;
/**
* Created by pkpk1234 on 2017/5/16.
*/
public class HeapSort {
public static void heapSort(int[] array) {
int length = array.length;
int endIdx = length - 1;
for (int i = 0; i < endIdx; i++) {
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.commons.dbutils.DbUtils;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.sql.DataSource;
import java.io.*;
import java.sql.Connection;
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ljm</groupId>
<artifactId>XXXX</artifactId>
<version>1.0-SNAPSHOT</version>
@pkpk1234
pkpk1234 / ClhSpinLock.java
Created September 29, 2016 14:50 — forked from kylefeng/ClhSpinLock.java
A simple CLH spin lock implementation.
public class ClhSpinLock {
private final ThreadLocal<Node> pred;
private final ThreadLocal<Node> node;
private final AtomicReference<Node> tail = new AtomicReference<Node>(new Node());
public ClhSpinLock() {
this.node = new ThreadLocal<Node>() {
protected Node initialValue() {
return new Node();
}
#include <stdio.h>
int main(void) {
char words[10];
printf("Enter a string\n");
while(fgets(words,10,stdin) != NULL && words[0] != '\n') {
fputs(words,stdout);
}
puts("Done.");
return 0;