Skip to content

Instantly share code, notes, and snippets.

@hushi55
hushi55 / jprobe_etn_io.c
Created December 28, 2017 09:35 — forked from dzeban/jprobe_etn_io.c
jprobes example
/*
* Here's a sample kernel module showing the use of jprobes to dump
* the arguments of third-party network driver for Bercut ETN.
*
* For more information on theory of operation of jprobes, see
* Documentation/kprobes.txt
*
* Build and insert the kernel module as done in the kprobe example.
* You will see the trace data in /var/log/messages and on the
* console whenever do_fork() is invoked to create a new process.
@hushi55
hushi55 / Git-Cheatsheets.md
Created September 15, 2017 07:33 — forked from nerdalert/Git-Cheatsheets.md
Git Cheat Sheets

Git Cheat Sheets and Examples


@hushi55
hushi55 / Netfilter-IPTables-Diagrams.md
Created September 15, 2017 07:31 — forked from nerdalert/Netfilter-IPTables-Diagrams.md
Linux NetFilter, IP Tables and Conntrack Diagrams

Linux NetFilter, IP Tables and Conntrack Diagrams

IPTABLES TABLES and CHAINS

IPTables has the following 4 built-in tables.

1) Filter Table

Filter is default table for iptables. So, if you don’t define you own table, you’ll be using filter table. Iptables’s filter table has the following built-in chains.

@hushi55
hushi55 / gist:678f546655724d628a8354c0219be197
Created June 4, 2016 08:33 — forked from ilguzin/gist:6606011
How to convert Java Key Store file to pem/key for nginx
1. Convert our ".jks" file to ".p12" (PKCS12 key store format):
keytool -importkeystore -srckeystore oldkeystore.jks -destkeystore newkeystore.p12 -deststoretype PKCS12
1.1. List new keystore file contents:
keytool -deststoretype PKCS12 -keystore newkeystore.p12 -list
2. Extract pem (certificate) from ".p12" keysotre file:
@hushi55
hushi55 / kafka.md
Created March 24, 2016 10:15 — forked from lurenx/kafka.md
kafka introduction

Introduction to Kafka

Kafka acts as a kind of write-ahead log (WAL) that records messages to a persistent store (disk) and allows subscribers to read and apply these changes to their own stores in a system appropriate time-frame.

Terminology:

  • Producers send messages to brokers
  • Consumers read messages from brokers
  • Messages are sent to a topic
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PushbackInputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@hushi55
hushi55 / Im4javaUtil.java
Created October 30, 2015 06:42
Java 使用 gm 压缩图片
public class Im4javaUtil implements ImageUtil {
private static final Logger logger = LoggerFactory.getLogger(Im4javaUtil.class);
private static String tmpdir;
private static boolean WINDOW_OS = false;
static {
String osName = System.getProperty("os.name").toLowerCase();
@hushi55
hushi55 / SimpleImageInfo.java
Last active April 26, 2019 09:08
Java read image magic number get image's height and width , support png, jpg, tiff, bpm, gif format
import org.apache.log4j.Logger;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@SuppressWarnings("all")
public class SimpleImageInfo {