Skip to content

Instantly share code, notes, and snippets.

View kitsook's full-sized avatar

Clarence K.C. Ho kitsook

View GitHub Profile
@kitsook
kitsook / lsusb.txt
Created March 26, 2019 05:44
Jetson Nano lsusb
~$ sudo lsusb -v
Bus 002 Device 002: ID 0bda:0411 Realtek Semiconductor Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 3.20
bDeviceClass 9 Hub
bDeviceSubClass 0 Unused
bDeviceProtocol 3
ROCk module is loaded
userx is member of video group
=====================
HSA System Attributes
=====================
Runtime Version: 1.1
System Timestamp Freq.: 1000.000000MHz
Sig. Max Wait Duration: 18446744073709551615 (0xFFFFFFFFFFFFFFFF) (timestamp count)
Machine Model: LARGE
System Endianness: LITTLE
@kitsook
kitsook / Dockerfile
Created December 13, 2020 07:16
Alt attempt on Google CTF 2020 writeonly
FROM ubuntu:20.04
RUN apt-get update && apt-get upgrade -y && apt-get install -y socat
RUN set -e -x; \
groupadd -g 1337 user; \
useradd -g 1337 -u 1337 -m user
COPY attachments/chal /home/user/
COPY flag /home/user/
@kitsook
kitsook / ripVCD.sh
Last active April 6, 2021 00:42
Shell script to rip VCD with VLC and then transcode with ffmpeg
#!/bin/bash
set -e
## Script to rip VCD with VLC and then transcode with ffmpeg
if [ "${BASH_VERSINFO}" -lt 4 ]; then
echo "Require bash 4 or higher"
exit 1
fi
@kitsook
kitsook / ShufflePerformance.java
Created August 2, 2022 03:59
Simulate the performance issue of Collections.shuffle
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.concurrent.ForkJoinPool;
import java.util.stream.IntStream;
public class ShufflePerformance {
private static final int PARALLELISM = 4;
private static final int LIST_SIZE = 100;
@kitsook
kitsook / rules.yml
Created October 31, 2022 02:59
Rule based static analysis - rules
---
name: "BigDecimal explicit toString"
description: "find code that explicitly call BigDecimal toString"
condition: "resolvedMethodRef.getPackageName().toString().equals(\"java.math\") &&
resolvedMethodRef.getClassName().toString().equals(\"BigDecimal\") &&
node.getName().toString() == \"toString\""
actions:
- "System.out.print(\"Cautions! Explicitly calling BigDecimal toString() in \" + file.toString());
if (node.getRange().isPresent()) {
System.out.println(\" at \" + node.getRange().get().toString());
@kitsook
kitsook / Main.java
Created December 21, 2022 05:57
Testing HashMap with multi-thread operations under specific conditions
package net.clarenceho;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;