Skip to content

Instantly share code, notes, and snippets.

@Cheaterman
Cheaterman / tmptestudisks.py
Created May 20, 2022 13:59
/tmp/testudisks.py
import threading
import time
from dbus import SystemBus, Interface
from dbus.mainloop.glib import DBusGMainLoop, threads_init
from gi.repository import GLib
UDISKS2_SERVICE = 'org.freedesktop.UDisks2'
BLOCK_INTERFACE = f'{UDISKS2_SERVICE}.Block'
FILESYSTEM_INTERFACE = f'{UDISKS2_SERVICE}.Filesystem'
@Cheaterman
Cheaterman / eselection.py
Last active April 13, 2022 00:18
eselection.py
from dataclasses import dataclass, field
from typing import Callable, List
from samp import (
INVALID_TEXT_DRAW,
CancelSelectTextDraw,
CreatePlayerTextDraw,
GetTickCount,
IsPlayerConnected,
PlayerTextDrawAlignment,
@Cheaterman
Cheaterman / cmdparser.py
Created April 3, 2022 13:16
cmdparser.py
import inspect
import types
import samp
t_unauthorized = 'You are not allowed to use this command'
t_unauthd_color = 0xFF1111FF
_cmd_list = dict()
current_cmd = None
@Cheaterman
Cheaterman / main.py
Created March 31, 2022 16:58
main.py
import functools
import time
import trio
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import NumericProperty
@Cheaterman
Cheaterman / python.py
Last active November 11, 2022 16:19
Basic PySAMP+SQLAlchemy example
from samp import (
MAX_PLAYERS,
GetPlayerName,
GetPlayerScore,
IsPlayerConnected,
KillTimer,
SendClientMessage,
SetPlayerScore,
SetTimer,
)
@Cheaterman
Cheaterman / component_data.py
Created February 16, 2022 15:01
component_data.py
from dataclasses import dataclass
component_type_names = [
'Spoiler',
'Hood',
'Roof',
'Sideskirt',
'Lamps',
'Nitro',
@Cheaterman
Cheaterman / vehicle_data.py
Created February 16, 2022 15:00
vehicle_data.py
from dataclasses import dataclass
from typing import Dict, List
from .component_data import Component, components
@dataclass
class Vehicle:
id: int
name: str
@Cheaterman
Cheaterman / pysampcommands.py
Last active May 21, 2022 16:59
pysamp/commands.py
import functools
from dataclasses import dataclass, field
from typing import Any, Callable, Protocol
from samp import SendClientMessage # type: ignore
class CommandHandler(Protocol):
def __call__(self, playerid: int, *args: str) -> None: ...
@Cheaterman
Cheaterman / Dockerfile
Last active April 11, 2022 20:06
Dockerfile
FROM ubuntu:18.04
RUN \
apt-get update && \
apt-get install -y \
gpg \
wget \
&& \
wget -O- https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
gpg --dearmor - | \
tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \
@Cheaterman
Cheaterman / vehicles.py
Created January 7, 2022 22:25
vehicles.py
import random
from dataclasses import dataclass, field
from typing import ClassVar, Dict, List, Optional, Tuple
from samp import (
PLAYER_STATE_DRIVER,
PLAYER_STATE_ONFOOT,
AddVehicleComponent,
CallRemoteFunction,
ChangeVehicleColor,