Skip to content

Instantly share code, notes, and snippets.

View Stfort52's full-sized avatar

Jaehoon Baek Stfort52

  • POSTECH, Lab of Computational Biology
  • South Korea
  • 22:45 (UTC +09:00)
View GitHub Profile
@Stfort52
Stfort52 / candlestick.py
Last active December 26, 2024 08:49
Candlestick figure maker for fun
import pandas as pd
import matplotlib.pyplot as plt
def draw_candlestick(data, time_axis, window_size, **kwargs) -> plt.Figure:
"""
Draws a candlestick chart.
Parameters:
data (list or np.ndarray): Continuous data points.
time_axis (list or np.ndarray): Corresponding time points (timestamps or discrete steps).
from typing import Literal
import pandas as pd
def get_ensembl_mappings(
genes: list[str],
organism: str = "hsa",
server: Literal["www", "eu", "uswest", "asia", "gprofiler"] = "asia",
) -> pd.DataFrame:

Plot pytorch module parameters

A simple implementation.

plot

@Stfort52
Stfort52 / ens2seq.py
Created May 10, 2024 07:25
Simple uniprot interface, not suitable for real querying
def ens2seq(ensembl_id: str) -> str:
"""Converts ensembl gene id to protein sequence
@ensembl_id: str, ensembl gene id
"""
uri = f"https://rest.uniprot.org/uniprotkb/stream?"
query = f"({ensembl_id}) AND (reviewed:true)"
params = {
"compressed": "false",
@Stfort52
Stfort52 / celltypist-cv.ipynb
Created August 17, 2023 07:57
Train Celltypist with your data and perform 5-fold Cross-Validation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Stfort52
Stfort52 / _vm.md
Last active December 17, 2022 05:41
Write-up for CODEGATE 2022 Finals Reversing challenge VM

CODEGATE 2022 Finals VM

Analysis

We are given a virtual machine binary called run, and a custom binary for it called VM. It has 16 registers and a flat memory. Below is the opcodes of this VM.

image

Then, we should disassemble the given program to see what's going on. disasm.py disassembles the custom binary VM into disassembly.S. Take a look at it.

@Stfort52
Stfort52 / verylog.md
Last active October 24, 2023 08:15
Write-up for CODEGATE 2022 Finals reversing challenge verylog

CODEGATE 2022 Finals verylog

TL;DR

Analysis

These modules,

  1. generate six permutation states from fixed seed (T_0)
  2. opens key.txt(T_2)
  3. reads each numbers from key.txt(T_3)
  4. generates answer by permutation (T_1)
  5. compares answer with input (T_3)
@Stfort52
Stfort52 / treebox.md
Last active April 4, 2023 06:13
Write-up for the sandbox task from Gooooooogle CTF 2022 treebox

Google CTF 2022 treebox

Analysis

It's one of those python sandboxing problems. You enter python script, server evaluates....if it passes the filter function below.

def verify_secure(m):
  for x in ast.walk(m):
    match type(x):
 case (ast.Import|ast.ImportFrom|ast.Call):
@Stfort52
Stfort52 / segfault-lab.md
Last active July 21, 2022 10:49
write-up for gooooooogle CTF 2022 segfault labyrinth

GCTF 2022 segfault labyrinth

This is a write-up for task segfault labyrinth in google ctf 2022

Analysis

The problem is consisted with a single amd64 binary. What it does is simple. It just runs your shellcode with some limitations. For example, there is a seccomp filter which prevents you from getting new file descriptors.

 line  CODE  JT   JF      K
=================================
 0000: 0x20 0x00 0x00 0x00000004  A = arch
@Stfort52
Stfort52 / colors.h
Last active July 7, 2022 07:58
Colors == Justice
#ifndef __LIB_COLORS_H
#define __LIB_COLORS_H
#ifndef NO_COLORS
/**
* ANSI Escapes for Normal Colors.
*/
#define BLK(TEXT) "\x1b[30m"TEXT"\x1b[0m"
#define RED(TEXT) "\x1b[31m"TEXT"\x1b[0m"