Skip to content

Instantly share code, notes, and snippets.

View dumpmem.c
#include <windows.h>
#include <psapi.h> // for GetMappedFileName
#include <stdio.h>
static const struct memprot_name_type {
unsigned int value;
const char *short_name;
const char *desc;
} memprot_names[] = {
{PAGE_NOACCESS, "noa", "PAGE_NOACCESS"},
View machine-learning
Naive Bayes
Logistic Regression
Sequential Minimal Optimization
Laxy-Ibk
Random Committee
Decision Table
PART
J48
LMT
Random Forest Tree
View DiscretionaryRoundRobin.java
/* Discretionary Round Robin
A DFQ tries to achieve the same criterias as in a Round Robin Queue
1. No starvation.
2. Traffic Shaping: throughput and burst guarantee
Instead of controlling _when_ to send as in normal traffic shaping queue,
DRR decides whether to send. When a sender wants to send a packet, it first
calls Flow.send(size). DRR either returns "Yes. You can send now" or "No.
Check with me again after t seconds."
*/
View DiscretionaryFairQueue.java
/* Discretionary Fair Queue
A DFQ tries to achieve the same criterias as in WFQ:
1. Fairness: equivelent to byte-level round-robin
2. Traffic Shaping: throughput and burst guarantee
Instead of controlling _when_ to send as in WFQ, DFQ decides whether to
send. When a sender wants to send a packet, it first calls
Flow.send(size). DFQ either returns "Yes. You can send now" or "No. Check
with me again after t seconds."
*/
@wuyongzheng
wuyongzheng / TestSelect.java
Last active Aug 29, 2015
Java Selector behaviour
View TestSelect.java
import java.net.InetSocketAddress;
import java.nio.channels.Selector;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
import java.nio.ByteBuffer;
public class TestSelect
{
public static void main (String [] args) throws Exception
{
View CFBTest.java
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import javax.crypto.spec.IvParameterSpec;
public class CFBTest
{
final protected static char[] hexArray = "0123456789abcdef".toCharArray();
public static String bytesToHex(byte[] bytes, int offset, int size) {
char[] hexChars = new char[size * 2];
for ( int j = 0; j < size; j++ ) {
@wuyongzheng
wuyongzheng / gist:b9a9bf4900841c1d4e6d
Last active Aug 29, 2015
Problem: re-order correction code
View gist:b9a9bf4900841c1d4e6d
Problem: re-order correction code
You need to send a message through a datagram channel which may reorder
packets. It only reorder packets, but not drop or duplicate packets. You are
asked to design an efficient error correction code that can reliably deliver a
message. Minimal packets should be used. Specifically, you need to design two
functions (Java syntax for illustration purpose):
1. byte[][] encode (byte[] message, int packetSize)
2. byte[] decode (byte[][] packets)
@wuyongzheng
wuyongzheng / ECDH_BC.java
Last active Sep 6, 2021
Elliptic curve Diffie–Hellman using Bouncy Castle v1.50 example code
View ECDH_BC.java
import java.math.BigInteger;
import java.security.PublicKey;
import java.security.PrivateKey;
import java.security.KeyFactory;
import java.security.Security;
import java.security.KeyPairGenerator;
import java.security.KeyPair;
import java.security.SecureRandom;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.ECGenParameterSpec;
View CBackend.txt
"Writing an LLVM Backend" http://llvm.org/docs/WritingAnLLVMBackend.html
"llvm commit: Remove the C backend" https://github.com/llvm-mirror/llvm/commit/a443e5b1f1013612950fc3c9ebfafca60a1c20df
"clang commit: Remove the vestiges of the C backend" https://github.com/llvm-mirror/clang/commit/f102c45ed9caf6f0002edb2adb19687e25ec20d3
@wuyongzheng
wuyongzheng / soot-error
Created May 16, 2014
soot android framework error
View soot-error
$ git log -1
commit 6ec014ac4b72e309c561f01726c2c7c8e39284be
Author: Steven Arzt <Steven.Arzt@cased.de>
Date: Thu May 15 11:39:04 2014 +0200
Fixed some previously horribly hacky code for parsing annotations. Now it also works with malware samples that do not provide a full InnerClass annotation
$ git diff
diff --git a/src/soot/Scene.java b/src/soot/Scene.java