Skip to content

Instantly share code, notes, and snippets.

View Rami-Sabbagh's full-sized avatar

Rami Sabbagh Rami-Sabbagh

View GitHub Profile
Copy of deleted topic: https://www.reddit.com/r/gamedev/comments/jumvi5/dualsense_haptics_leds_and_more_hid_output_report/
---
outputReport[0] = 0x02; // report type
outputReport[1] = 0xff; // flags determiing what changes this packet will perform
// 0x01 set the main motors (also requires flag 0x02); setting this by itself will allow rumble to gracefully terminate and then re-enable audio haptics, whereas not setting it will kill the rumble instantly and re-enable audio haptics.
// 0x02 set the main motors (also requires flag 0x01; without bit 0x01 motors are allowed to time out without re-enabling audio haptics)
// 0x04 set the right trigger motor
@Rami-Sabbagh
Rami-Sabbagh / HD4470.lua
Created March 22, 2018 04:25
Lua HD44780 Demo using Lua-Periphery and lua-socket (socket.sleep) !
--HD44780 LCD Driver by Rami Sabbagh
--Licensed under MIT
local bits = require("bit")
local band,bor,lshift,rshift = bit.band, bit.bor, bit.lshift, bit.rshift
local socket = require("socket")
local periphery = require('periphery')
local GPIO = periphery.GPIO
@Rami-Sabbagh
Rami-Sabbagh / Matrix.lua
Last active April 7, 2018 10:10
Raspberry Pi Lua GPIO LED Matrix
--LED Matrix RAMI
local json = dofile("/home/pi/Desktop/Matrix/json.lua")
local socket = require("socket")
local periphery = require('periphery')
local GPIO = periphery.GPIO
print("Using GPIO:",GPIO.version)
@Rami-Sabbagh
Rami-Sabbagh / MicroLua.lua
Created June 13, 2017 12:38
PowderToy Micro Lua Proccessors
--Creating the elements--
local elem_group = "MLUA"
local elem_names = { "LMPU", "LCBL", "LPIN", "LMRC", "LROM" } --The names of the elements to allocate
local elem_id = {} --A table containing the ids of every name in elem_names, [name] = id.
local elem_name = {} --A table to get the name from the id
--Allocate the elements
for k, name in ipairs(elem_names) do
if elements[elem_group.."_PT_"..name] then elements.free(elements[elem_group.."_PT_"..name]) end --Incase the script errored
local id = elements.allocate(elem_group, name)
@Rami-Sabbagh
Rami-Sabbagh / user.lua
Last active May 22, 2017 19:30
ZeroBraneStudio Verbose File Backup Saving Plugin
-- You have to add this to zbs user.lua configuration file
verbose_folder = "C:/Users/Your_User/Documents/ZBS Backup/" --For example, you must use / , and be sure that the path ends with /
@Rami-Sabbagh
Rami-Sabbagh / verbose_saving.lua
Created May 22, 2017 18:14
ZeroBraneStudio Verbose File Backup Saving Plugin
return {
name = "Verbose Saving",
description = "Verbose File Saving, saves a copy of each file on save in a spereate directory with data and time appended to the file name.",
author = "Rami Sabbagh",
version = 1.0,
splitFilePath = function(path)
local p,n,e = path:match("(.-)([^\\/]-%.?([^%.\\/]*))$")
n = n:sub(0,-(e:len()+2))
return p,n,e
@Rami-Sabbagh
Rami-Sabbagh / LuaTable.lua
Last active July 5, 2020 17:03
A lua library that converts tables to Lua code that can be saved
local LuaTable = {
_VERSION = 'LuaTable v1.0.2 2016/08/27',
_AUTHOR = 'RamiLego4Game',
_URL = 'https://gist.github.com/RamiLego4Game/f656f5c1a118f77c3b7a08f4c65efaaf',
_DESCRIPTION = 'A library that converts tables to Lua code that can be saved',
_LICENSE = [[
MIT LICENSE
Copyright (c) 2016 Rami Sabbagh
--# Main
supportedOrientations(LANDSCAPE_RIGHT)
displayMode(OVERLAY)
-- CodeaBalls
-- Use this function to perform your initial setup
function setup()
edge1 = physics.body( EDGE, vec2(0,0), vec2(WIDTH,0) )
edge1.type = STATIC
edge1.sleepingAllowed = false