Skip to content

Instantly share code, notes, and snippets.

@emdeex
emdeex / js_linux.py
Last active October 12, 2021 16:49 — forked from rdb/js_linux.py
Access joysticks/game controllers from Python in Linux via the joystick driver. See https://www.panda3d.org/forums/viewtopic.php?f=8&t=16767
# Released by rdb under the Unlicense (unlicense.org)
# Based on information from:
# https://www.kernel.org/doc/Documentation/input/joystick-api.txt
import os, struct, array
from fcntl import ioctl
# Iterate over the joystick devices.
print('Available devices:')
@robertcedwards
robertcedwards / Assetto-dash.py
Created August 18, 2015 23:58
Assetto Corsa Fan Control using Python API & Arduino
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "dll"))
import ac
import acsys
import serial
import time
#ser = serial.Serial(3, 9600)
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

import socket
import struct
import json
def unpack_varint(s):
d = 0
for i in range(5):
b = ord(s.recv(1))
d |= (b & 0x7F) << 7*i
if not b & 0x80: