Skip to content

Instantly share code, notes, and snippets.

View V3ntus's full-sized avatar
Remind me to code again

Ventus V3ntus

Remind me to code again
View GitHub Profile
@V3ntus
V3ntus / README.md
Created July 26, 2024 13:09
Strawberry GraphQL dynamic query builder

What do you consider boilerplate? Is all code boilerplate? Are humans boilerplate?

Anyways, I found a stupid way to generate a whole GraphQL schema on the fly based on a dictionary of query name to source and Strawberry models. This was used in a Strawberry + FastAPI + SQLAlchemy API project.

You essentially define a mapping for your queries. Specify the query name, and which ORM or source class/model goes to the GraphQL model equivalent. The logic will then create a new Query class object, iterate over the mapping items defined above, then generate a binding with the query name, model, and GraphQL schema associated. This binding is also dynamically generated by altering the query function's signature on runtime which contains the shared, boilerplate logic between all queries.

@V3ntus
V3ntus / shell.nix
Created July 3, 2024 15:47
Nix/NixOS shell for Flutter desktop development
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
clang
cmake
ninja
pkg-config
gtk3
@V3ntus
V3ntus / automate_pivot.sh
Last active August 7, 2024 21:22
How to tunnel with ligolo-ng
#!/bin/bash
# If you do not have ssh keys for root, remove all -i flag and $REMOTE_ROOT_KEYS instances from the script
REMOTE= # IP/hostname of remote target
REMOTE_ROOT_KEYS= # path to id_rsa of root user on remote target
LIGOLO_AGENT= # path to agent binary
LIGOLO_PROXY= # path to proxy binary
CURRENT_USER=$(whoami)
echo "[L] Uploading agent to remote..."
@V3ntus
V3ntus / openweather_model.py
Last active April 17, 2022 20:30
OpenWeather Python data model/serializer
class OpenWeatherModel(object):
__slots__ = "_json", "cod", "message", "base", "weather", "main", "name", "wind", "sys", "cod", "temp", "feels_like", "temp_min", \
"temp_max", "pressure", "humidity", "speed", "deg", "gust", "sunrise", "sunset", "country", "timezone", \
"visibility"
def __init__(self, **kwargs):
self._json = kwargs
for key in kwargs:
if key in self.__slots__:
@V3ntus
V3ntus / discord_rich_presence_low_level.md
Created February 4, 2022 04:07
My notes on how Discord Rich Presence works on a low level

How to intercept Unix socket messages

If on Linux/Mac OS Discord

# example commands
sudo mv $XDG_RUNTIME_DIR/discord-ipc-0 ./discord-ipc-0 # backup original socket
sudo socat -t100 -x -v UNIX-LISTEN:$XDG_RUNTIME_DIR/discord-ipc-0,mode=777,reuseaddr,fork UNIX-CONNECT:$(pwd)/discord-ipc-0

socat opens a bidirectional tunnel that will forward message to and from these two sockets. -v will print debug message to stdout, allowing you to read the raw hex data traffic

@V3ntus
V3ntus / t450s_hackintosh.md
Last active October 20, 2021 01:44
Attempts at installing Mac OS on a Thinkpad T450s

[NO] = Does not work
[NO ?] = Did not have good results, but still testing
[?] = Still testing

Main methods tried: (working method at bottom)

1. [NO] Searched for GH repos hosting EFIs for T450s setups. One here Following instructions as of 10/18/2021 resulted in OpenCore booting a black screen.
2. [NO ?] Attempting to follow the guide here mentioned in an issue in above repo. MacOS Catalina in VMs run extremely slow.
Following and using the ISO in this guide:

  • VirtualBox 6.26 - Extremely slow
  • VirtualBox 6.20 - Extremely slow

Keybase proof

I hereby claim:

  • I am v3ntus on github.
  • I am 3xcalibur (https://keybase.io/3xcalibur) on keybase.
  • I have a public key ASAZ2usIZ6kvkPSWq6inILrBU3G7M2D_NeOlcIcjI-xT0Qo

To claim this, I am signing this object: