Skip to content

Instantly share code, notes, and snippets.

@dogtopus
dogtopus / ds5.desc.xml
Last active June 27, 2024 08:43
DualSense descriptor
<?xml version="1.0"?>
<!--
DualSense (DS5) USB HID Report Descriptor
Documentation WIP
TODO: Extract info from hid-playstation and cross-verify with us.
-->
@matteocaberlotto
matteocaberlotto / create-database.sh
Created February 26, 2016 14:13
bash script to create user and database
#!/bin/bash
if [ "$1" == "" ]; then
echo "Error: database required: use create-database <db_name> <username> <password>"
exit 1
fi
if [ "$2" == "" ]; then
@matteocaberlotto
matteocaberlotto / sync_database.sh
Last active December 28, 2016 03:45
A simple bash script to sync a local database with a remote one (for development purpose)
#!/bin/bash
# configure script parameters here
USERNAME=username # username for ssh/scp connection
SERVER=123.123.123.123 # server ip for ssh/scp connection
PORT=22 # ssh port
ADDITIONAL_SSH_PARAMS="-i mykeys.pem" # additional ssh parameters to append to ssh and scp commands
REMOTE_DATABASE_NAME=exampledb # name of the database on the remote server (used with dump script and as sql remote filename)
@matteocaberlotto
matteocaberlotto / dump-db.sh
Last active May 2, 2017 10:44
Dumps a mysql database daily at midnight (with day of the week rotation)
#!/bin/bash
_dow="$(date +'%A'|cut -c 1-3)"
# dumps the database with day of the week appended
mysqldump mydb -u db-user -p'password' > "/home/ubuntu/databases/database-demo-${_dow,,}.sql"
# copies last db dumped
cp "/home/ubuntu/databases/database-demo-${_dow,,}.sql" /home/ubuntu/database-demo.sql
@johndrinkwater
johndrinkwater / dualshock-research
Last active March 16, 2024 15:12
I’m interested in writing (or helping to spec out the protocol so someone else can write) the linux kernel driver for Sony’s DualShock 4 (PS4’s lovely controller) Currently using the output of HID RAW from a USB connected dualshock 4… For the gyro/touchpad discovery, I’ve just been using some terrible c code to throw numbers on the screen and it…
TADA, it’s `hexdump -v -e '64/1 "%02x" "\n"' < /dev/hidraw3`
No idea what the first byte is… but I’m going to assume its for device ID for the many users that are connected, but it probably has to be set by the connected machine?
01ff777f7f0800aa0000435dfdf1ff14000200c5ff0721150300000000001b000001fc9133a32990880428008000000080000000008000000080000000008000
↑↑↑↑
left stick, value, first field is horz (00 left), second field is vertical (00 top)
017f80ff61080064000059f2fdfffffbff0e00d107081e9bf600000000001b0000018e94b1b00690880428008000000080000000008000000080000000008000
↑↑↑↑
@matteocaberlotto
matteocaberlotto / deploy-symfony.sh
Last active April 20, 2022 14:51
Deploy symfony 2+ applications (multiple environment)
#!/bin/bash
# include config
# config example below:
#
#
# Example deploy_config.sh
#
# dev_env() {
@mnapoli
mnapoli / reference.yml
Last active January 12, 2023 00:08
Doctrine YAML configuration reference
# Inspired from http://blog.hio.fr/2011/09/17/doctrine2-yaml-mapping-example.html
MyEntity:
type: entity
repositoryClass: MyRepositoryClass
table: my_entity
namedQueries:
all: "SELECT u FROM __CLASS__ u"
# Class-Table-Inheritance
@mattgorecki
mattgorecki / facedetect.py
Created July 21, 2011 02:14
Detecting faces with SimpleCV
#!/usr/bin/python
import SimpleCV
import time
import simplejson as json
import sys
if __name__ == "__main__":
captureDir = '/opt/display/applications/tldisplayclient/static'
ofilename = '%s/webcam-original.png' % captureDir
dfilename = '%s/webcam-detected.png' % captureDir