Skip to content

Instantly share code, notes, and snippets.

View ansgomez's full-sized avatar

Andres Gomez ansgomez

View GitHub Profile
# install xcodes
brew install robotsandpencils/made/xcodes aria2
# install & select latest version of xcode
xcodes list | awk 'END{system("xcodes install " $1"; xcodes select " $1)}'
# install x86-64 homebrew
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# switch to x86_64 homebrew
@ansgomez
ansgomez / example.svg
Created April 5, 2024 16:57 — forked from hackerb9/example.svg
Extract vector images from funky PDF files
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ansgomez
ansgomez / README.md
Created November 5, 2023 06:54 — forked from straker/README.md
Basic Pong HTML and JavaScript Game

Basic Pong HTML and JavaScript Game

This is a basic implementation of the Atari Pong game, but it's missing a few things intentionally and they're left as further exploration for the reader.

Further Exploration

  • Score
  • When a ball goes past a paddle, the other player should score a point. Use context.fillText() to display the score to the screen
@ansgomez
ansgomez / Accel_Read.js
Created June 22, 2023 10:18
Use this code with the Puck.js to read accelerometer values
//Turn on accelerometer with 1.6 Hz
Puck.accelOn(1.6);
//Print accelerometer values every two seconds
setInterval(function () {
var m = Puck.accel();
console.log("X: " + m.acc.x + " Y: " + m.acc.y + " Z: " + m.acc.z);
}, 2000);
@ansgomez
ansgomez / IR_Send.js
Created June 22, 2023 10:01
Use this code with the Puck.js to periodically send one type IR packet
var commands = {
on: [8.9,4.5,0.5,0.5,0.6,0.6,0.5,0.6,0.5,0.6,0.5,0.5,0.5,0.5,0.6,0.5,0.6,0.5,0.6,1.7,0.6,1.6,0.6,1.6,0.6,1.6,0.6,1.6,0.6,1.6,0.6,1.6,0.6,1.6,0.6,0.5,0.6,0.5,0.6,0.6,0.5,1.7,0.5,0.6,0.5,0.5,0.6,0.5,0.5,0.6,0.5,1.6,0.5,1.7,0.7,1.6,0.5,0.6,0.5,1.6,0.6,1.6,0.6,1.6,0.6,1.6,0.6],
off: [8.9,4.5,0.6,0.5,0.6,0.5,0.5,0.6,0.5,0.6,0.6,0.5,0.5,0.6,0.5,0.6,0.5,0.6,0.5,1.7,0.6,1.7,0.5,1.6,0.6,1.6,0.6,1.6,0.6,1.6,0.6,1.6,0.6,1.7,0.5,0.6,0.5,1.7,0.5,0.6,0.5,1.6,0.6,1.6,0.6,0.5,0.6,1.6,0.6,0.5,0.6,1.6,0.6,0.5,0.6,1.6,0.6,0.5,0.6,0.5,0.5,1.7,0.5,0.6,0.5,1.7,0.5,39.7,8.9,2.2,0.6]
};
setInterval(function () { Puck.IR(commands["on"]) }, 1000);
@ansgomez
ansgomez / IR_Read.js
Created June 22, 2023 10:00
Use this code with a Puck.js and an IR receiver to detect packets
digitalWrite(D1,0);
pinMode(D29,"input_pullup");
var d = [];
setWatch(function(e) {
d.push(1000*(e.time-e.lastTime));
}, D29, {edge:"both",repeat:true});
var lastLen = 0;
setInterval(function() {
if (d.length && d.length==lastLen) {
import logging
from coapthon.client.helperclient import HelperClient
IP_ADDRESS = "130.82.171.100"
PORT = 13083
def handle_pose(response):
if(bool(response)):