Skip to content

Instantly share code, notes, and snippets.

View Taormina's full-sized avatar

Anthony Taormina Taormina

View GitHub Profile
@Taormina
Taormina / cli.rb
Created October 10, 2019 19:58
Unite Us Backend Challenge
require './primes.rb'
input, *rest = ARGV
size = input.to_i
if !rest.empty? || !size.is_a?(Integer) || size <= 0 then
puts "usage: ruby cli.rb <size>\n<size> should be given as a positive integer"
return
end
@Taormina
Taormina / check-for-updates.py
Last active December 17, 2020 13:19
Check pub.dev for updates to dart packages
"""
MIT LICENSE
Copyright (c) 2019 Taormina Innovations LLC
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
@Taormina
Taormina / placebo.sh
Last active August 29, 2015 14:05
Placebo CLI
#!/bin/bash
FLASK='http://127.0.0.1:5000'
if [ "$1" = "add" ]
# Update or add a new dummy endpoint at path $2 that returns $3
then
curl -H "Content-Type: application/json" -d $3 $FLASK/reserved/$2
elif [ "$1" = "del" ]
# Delete the endpoint at path $2
then
curl -X DELETE $FLASK/reserved/$2
@Taormina
Taormina / flask_server.py
Created September 2, 2014 01:08
Placebo - A Dummy Endpoint Generator
from flask import Flask, request, abort
app = Flask(__name__)
responseMap = {}
@app.route('/reserved/<path:endpoint>', methods=['POST', 'PUT'])
def add_endpoint(endpoint):
responseMap[endpoint] = request.data
return "HTTP 200 - Endpoint {0} added!\nResponse: {1}\n".format(endpoint, responseMap[endpoint])
@Taormina
Taormina / screenshot.sh
Created November 7, 2013 18:56
Android dev tip: Grab screen shot with one command.
#!/bin/bash
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png
@Taormina
Taormina / validate.py
Last active July 30, 2016 17:57
A module that can be simply imported into any Python project to allow for checking to see if a Skype username is valid or not.
import requests
def checkName(name):
values = { "new_username" : name }
r = requests.post("https://login.skype.com/json/validator", values)
return "not available" in r.json()[u'data'][u'markup']
@Taormina
Taormina / validate.py
Created April 24, 2013 22:23
A script that generates the validations for CS4290 Project 3 as quickly as possible. If a diff actually prints something, then that validation failed.
import os, threading
class ThreadClass(threading.Thread):
def __init__(self, p, c):
super(ThreadClass, self).__init__()
self.p = p
self.c = c
def run(self):
trace_location = "traces/" + self.c + "proc_validation"