Skip to content

Instantly share code, notes, and snippets.

View jdabtieu's full-sized avatar

Jonathan Wu jdabtieu

View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/wait.h>
#include <errno.h>

Replication Steps

These steps will need to be done on two different machines on the same network, one as a client and another as a server.

  1. VM: Install Ubuntu 24.04 on VirtualBox (other hypervisors may work but local Hyper-V won't support DPDK)
    Baremetal: on Cloudlab, follow the section on requesting resources here to acquire two nodes that have the correct hardware
  2. (VM only) Configure the VM with at least 4GB RAM, 8 vCPUs, PAE/NX enabled, Nested VT-x, Nested paging, and two network adapters (both bridged, using the virtio-net driver)
  3. Follow the steps here: https://github.com/microsoft/demikernel/blob/dev/doc/setup.md to build DPDK and set up Demikernel. You may need to apply this diff: https://gist.github.com/jdabtieu/0b947ae141eb82bb3188e056c1c65d8e and rebuild if an issue with RSS_HF shows up later.
  4. For the configuration file: Run ip addr to grab the MAC address, IP address, and interface name. Run lspci to get the PCI ID o
diff --git a/src/rust/catnip/runtime/mod.rs b/src/rust/catnip/runtime/mod.rs
index 884dec5a..86c00d5d 100644
--- a/src/rust/catnip/runtime/mod.rs
+++ b/src/rust/catnip/runtime/mod.rs
@@ -20,7 +20,7 @@ use crate::{
rte_eth_dev_get_mtu, rte_eth_dev_info, rte_eth_dev_info_get, rte_eth_dev_is_valid_port,
rte_eth_dev_set_mtu, rte_eth_dev_start, rte_eth_find_next_owned_by, rte_eth_link, rte_eth_link_get_nowait,
rte_eth_promiscuous_enable, rte_eth_rss_ip, rte_eth_rx_burst,
- rte_eth_rx_mq_mode_RTE_ETH_MQ_RX_RSS as RTE_ETH_MQ_RX_RSS, rte_eth_rx_offload_tcp_cksum,
+ rte_eth_rx_mq_mode_RTE_ETH_MQ_RX_NONE as RTE_ETH_MQ_RX_NONE, rte_eth_rx_offload_tcp_cksum,
@jdabtieu
jdabtieu / crator.md
Created August 18, 2024 23:58
idekCTF 2024 web/crator

Crator

Description

I made a new website to compete against my friends to see who could write faster code. Unfortunately, I don't actually know how to write that much code. Don't tell them, but ChatGPT wrote this entire website for me. Can you solve the problems for me?

Attachments: crator.tar.gz

Commentary

@jdabtieu
jdabtieu / memoryfs.md
Last active October 14, 2024 18:16
idekCTF 2024 misc/memoryfs

MemoryFS

Description

Are you sick and tired of law enforcement busting down your door, stealing your hard drives, and then finding all your pirated movies? Well, fret no more, because with MemoryFS, once those goons unplug your computer, your files are wiped!

Attachments: main.py

Commentary

SimpleFileServer - idekCTF 2022

Description

All I wanted was a website letting me host files anonymously for free, for ever

Link

simple-file-server.tar.gz

Engraver - Google CTF 2022

Description

You can see pictures of a robot arm laser engraver attached. Can you figure out what it is engraving?

Note: the flag should be entered all in upper case. It contains underscores but does not contain dashes.

@jdabtieu
jdabtieu / Main.java
Last active March 28, 2022 03:33
Enables colors in the Windows terminal for Java console programs. Read the comment before blindly copy pasting!
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.net.URLClassLoader;
public class Main {
static void enableColor() {
// https://stackoverflow.com/questions/52767585/how-can-you-use-vt100-escape-codes-in-java-on-windows
try {
// Load classes
@jdabtieu
jdabtieu / IO.java
Last active July 18, 2021 18:37
Java Fast IO (even faster than BufferedReader). Key differences: no thread safety, doesn't ensure that the input stream is still open, does not create unncessary objects
import java.io.InputStreamReader;
import java.io.IOException;
public class IO {
static InputStreamReader br = new InputStreamReader(System.in);
static char[] ibuf = new char[65536];
static int iptr = 0;
static int imax = 0;
static int readInt() throws IOException {
int x = 0;
@jdabtieu
jdabtieu / fastio.cpp
Last active August 8, 2021 02:20
C++ Fast IO (read & print signed & unsigned ints)
// IMPORTANT: Call Write(); at the end of your main function to flush the output buffer
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC optimize ("Ofast")
int oPtr = 0;
#ifdef WIN64
char sc() {return getchar();}
void pc(char c) {putchar(c);}