This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from timeit import default_timer as timer | |
PORT = "9999" | |
PRED_KERAS_REST_API_URL = "http://localhost:"+PORT+"/predict" | |
TIME_KERAS_REST_API_URL = "http://localhost:"+PORT+"/time" | |
IMAGE_PATH = "small.jpg" | |
# load the input image and construct the payload for the request | |
image = open(IMAGE_PATH, "rb").read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param ( | |
[Parameter(Mandatory=$true)] | |
[string] | |
$ClearString | |
) | |
$hasher = [System.Security.Cryptography.HashAlgorithm]::Create('sha256') | |
$hash = $hasher.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($ClearString)) | |
$hashString = [System.BitConverter]::ToString($hash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOADING=false | |
DEBUG=/dev/null | |
usage() | |
{ | |
cat << EOF | |
usage: $0 [options] <DBNAME> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getAngleRad(p1, p2){ | |
// returns the angle between 2 points in radians | |
// p1 = {x: 1, y: 2}; | |
// p2 = {x: 3, y: 4}; | |
return Math.atan2(p2.y - p1.y, p2.x - p1.x); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo ln -s "/Applications/Visual Studio Code.app/Contents/MacOS/Electron" /usr/local/bin/code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew cask install dockertoolbox | |
docker-machine create --driver virtualbox default | |
docker-machine ls | |
eval $(docker-machine env default) | |
Put the exports in this eval in your .zshrc or .bashrc if you use bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X POST \ | |
-H "X-Parse-Application-Id: LL9oIdzIkmwl5xyowQQu0fTmXyUWfet9RuAzwHfj" \ | |
-H "X-Parse-REST-API-Key: R3S8PYQKuzeV4c8MUeO5ved46C50MEp56boDHW1O" \ | |
-H "Content-Type: application/json" \ | |
-d @data.json \ | |
https://parseapi.back4app.com/functions/import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.i = 0; | |
$scope.likeClick = function(data){ | |
$scope.data[$scope.i].likes.byUser = $dataservice.likeClick(data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get(req, res) { | |
var Foo, | |
query, | |
foos; | |
Foo = Parse.Object.extend("Foo", {}, {}); | |
query = new Parse.Query(Foo); | |
foos = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the main app file | |
import express from "express"; | |
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db) | |
import authenticate from "./authentication"; // middleware for doing authentication | |
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request | |
const app = express(), | |
api = express.Router(); | |
// first middleware will setup db connection |
NewerOlder