Skip to content

Instantly share code, notes, and snippets.

View matthewfitz's full-sized avatar

Matt Fitzgerald matthewfitz

View GitHub Profile
@matthewfitz
matthewfitz / keycloak.sh
Last active November 13, 2017 17:58 — forked from paoloantinori/keycloak.sh
Keycloak Admin API Rest Example
brew install jq
@matthewfitz
matthewfitz / csv_splitter.py
Created November 29, 2011 19:07 — forked from palewire/csv_splitter.py
A Python CSV splitter
import os
def split(filehandler, delimiter=',', row_limit=10000,
output_name_template='output_%s.csv', output_path='.', keep_headers=True):
"""
Splits a CSV file into multiple pieces.
A quick bastardization of the Python CSV library.
Arguments:
<?php
$ch = curl_init("https://opensky.com/api/v1/json/users/exist?email=matthewfitz@gmail.com");
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X_OPENSKY_API_KEY: foobar'));
$head = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
<?php
$ch = curl_init("https://opensky.com/api/v1/json/users");
$encoded = urlencode('email').'='.urlencode('matthewfitz@gmail.com');
$encoded .= urlencode('firstName').'='.urlencode('Matt');
$encoded .= urlencode('lastName').'='.urlencode('Fitz');
$encoded .= urlencode('password').'='.urlencode('xxxxxx');
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_POST, TRUE);
<?php
$ch = curl_init("https://opensky.com/api/v1/json/heartbeat");
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_NOBODY, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X_OPENSKY_API_KEY: foobar'));
$head = curl_exec($ch);
POST https://opensky.com/api/v1/json/users
email=test@est.com
Status: 417
{
"code": 417,
"message": "There is an existing account associated with this email."
}
GET https://opensky.com/api/v1/json/users/exist?email=test_test.com
Status: 422
{
"code": 422,
"message": "Please provide valid email address"
}
GET https://opensky.com/api/v1/json/users/exist?email=test@test.com
Status: 404
{
"code": 404,
"message": "Not Found"
}
GET https://opensky.com/api/v1/json/users/exist
Status: 400
{
"code": 400,
"message": "Bad Request"
}
Status: 200 OK
{
"code": 200,
"message": "User exists"
}