Skip to content

Instantly share code, notes, and snippets.

@dsposito
dsposito / api_tests.sh
Last active August 29, 2015 14:10
Super simple API endpoints test script for Volcano: https://github.com/volcano/volcano
# Sellers
curl -X POST -s -o /dev/null -w "%{http_code} - POST - %{url_effective}\n" --data "name=Seller X&contact[company_name]=Seller X, Inc&contact[email]=sellerx@gmail.com" dev.volcano.com/api/sellers
curl -X GET -s -o /dev/null -w "%{http_code} - GET - %{url_effective}\n" dev.volcano.com/api/sellers/1
curl -X PUT -s -o /dev/null -w "%{http_code} - PUT - %{url_effective}\n" --data "name=Seller XY" dev.volcano.com/api/sellers/1
# Seller Callbacks
curl -X GET -s -o /dev/null -w "%{http_code} - GET - %{url_effective}\n" dev.volcano.com/api/sellers/1/callbacks
curl -X POST -s -o /dev/null -w "%{http_code} - POST - %{url_effective}\n" --data "event=product.meta.update&url=http://localhost/api/webhook" dev.volcano.com/api/sellers/1/callbacks
curl -X GET -s -o /dev/null -w "%{http_code} - GET - %{url_effective}\n" dev.volcano.com/api/sellers/1/callbacks/1
curl -X PUT -s -o /dev/null -w "%{http_code} - PUT - %{url_effective}\n" --data "url=http://loalhost/api/webhook/update" dev.volcano.com/api/sellers/1/callbac
@dsposito
dsposito / Numbers.php
Last active December 23, 2015 18:59
A simple class for interacting with numbers.
<?php
/**
* Contains methods for interacting with numbers.
*
* @author Daniel Sposito <daniel.g.sposito@gmail.com>
*/
class Number
{
/**
#!/usr/bin/env python
# ROS
import rospy
from mavros_msgs.srv import SetMode
from mavros_msgs.srv import CommandBool
# System
import time
@dsposito
dsposito / unmapped_listings_parser.py
Last active April 24, 2019 01:35
This script determines how many unmapped listings have 1-2 matches - which we could crowd source confirm the correct product to map.
import csv
unmapped_listings = 0
unmapped_listings_few_matches = 0
with open('lv-listings.csv') as csvfile:
data = csv.reader(csvfile, delimiter=',')
for row in data:
# Listing is missing a direct match loki_product_id.
if not row[11]:
#!/usr/bin/env python
# ROS
import rospy
from mavros_msgs.msg import OverrideRCIn
from mavros_msgs.srv import SetMode
from mavros_msgs.srv import CommandBool
from mavros_msgs.srv import CommandTOL
# System
from flask import Blueprint
web = Blueprint(
"web",
__name__,
url_prefix="/web",
template_folder="templates",
static_folder="static",
)
@dsposito
dsposito / Cards.php
Last active April 23, 2021 14:44
A simple class for interacting with a deck of cards.
<?php
/**
* Contains methods for interacting with a deck of cards.
*
* @author Daniel Sposito <daniel.g.sposito@gmail.com>
*/
class Deck
{
/**
@dsposito
dsposito / ros-takeoff-hover-land.py
Created March 29, 2018 07:20
ros-takeoff-hover-land.py
#!/usr/bin/env python
import rospy
from mavros_msgs.srv import SetMode
from mavros_msgs.srv import CommandBool
from mavros_msgs.srv import CommandTOL
import time
rospy.init_node('mavros_takeoff_python')
rate = rospy.Rate(10)