Skip to content

Instantly share code, notes, and snippets.

View phajduk's full-sized avatar
🎯
Delivering

Pawel Hajduk phajduk

🎯
Delivering
View GitHub Profile
#!/bin/bash
export DATABRICKS_TOKEN=<token>
export DATABRICKS_INSTANCE=<instance>
curl -X GET --header "Authorization: Bearer $DATABRICKS_TOKEN" \
https://$DATABRICKS_INSTANCE.cloud.databricks.com/api/2.0/preview/scim/v2/Me
# or
#https://$DATABRICKS_INSTANCE.cloud.databricks.com/api/2.0/clusters/list
@phajduk
phajduk / keybase.md
Created September 3, 2018 10:01
keybase.md

Keybase proof

I hereby claim:

  • I am phajduk on github.
  • I am phajduk (https://keybase.io/phajduk) on keybase.
  • I have a public key whose fingerprint is 98FF C974 7825 E640 9EA9 2AA1 7571 470A C2F4 89CC

To claim this, I am signing this object:

@phajduk
phajduk / UrlHelper.java
Created December 4, 2015 07:44
UrlHelper
public class UrlHelper {
public static Map<String, String> splitQuery(String query) {
Map<String, String> queryPairs = new LinkedHashMap<>();
String[] pairs = query.split("&");
for(String pair : pairs) {
int idx = pair.indexOf("=");
try {
queryPairs.put(URLDecoder.decode(pair.substring(0, idx), "UTF-8"), URLDecoder.decode(pair.substring(idx + 1), "UTF-8"));
} catch(UnsupportedEncodingException e) {
Timber.e(e, "Problem during parsing query args");
@phajduk
phajduk / gist:2e28254c6e1ecad37785
Created June 4, 2014 10:19
Getting mime type from file
Uri path = Uri.fromFile(file);
MimeTypeMap typeMap = MimeTypeMap.getSingleton();
String extension = MimeTypeMap.getFileExtensionFromUrl(path.toString()).toLowerCase();
if (extension.contains(".")) {
extension = extension.substring(extension.lastIndexOf("."));
}
String mimeType= typeMap.getMimeTypeFromExtension(extension);