Skip to content

Instantly share code, notes, and snippets.

View json4s_example.scala
import org.json4s._
import org.json4s.native.JsonMethods._
import org.json4s.native.Serialization
import org.json4s.native.Serialization.write
case class A(s: String, i: Int)
implicit val formats = Serialization.formats(NoTypeHints)
val a = A("a", 1)
ruseel / keycloak-rest-api-sample.clj
Last active Feb 27, 2020
Keycloak Admin REST API Sample
View keycloak-rest-api-sample.clj
;; this worked for me
(defn access-token []
(str base-url "/auth/realms/" realm "/protocol/openid-connect/token")
{:accept :json
:form-params {"client_id" "admin-cli"
"username" some-username
import random
import statsmodels
import pmap
groups = ["control", "treatment"]
SAMPLE = 1e4
ruseel / gist:bcd7ec7c31ef101d68112ea2a1b2709f
Created Oct 1, 2018
java.sql.Timestamp -
View gist:bcd7ec7c31ef101d68112ea2a1b2709f
(require '[ :refer [write JSONWriter]])
(defn write-timestamp [x out]
(write (str x) out))
(extend java.sql.Timestamp JSONWriter {:-write write-timestamp})
View deps.edn
{clj-time {:mvn/version "0.14.2"}
mysql/mysql-connector-java {:mvn/version "8.0.12"}
org.clojure/java.jdbc {:mvn/version "0.7.8"}
org.clojure/data.json {:mvn/version "0.2.6"}}}
View gist:26e98aea480f8c2138fa070c5f3930fc
[INFO] Scanning for projects...
[INFO] --------------------< org.apache.hadoop:hadoop-aws >--------------------
[INFO] Building Apache Hadoop Amazon Web Services support 2.7.7-socar1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] --- maven-antrun-plugin:1.7:run (create-testdirs) @ hadoop-aws ---
[INFO] Executing tasks
ruseel / sample.scala
Created Aug 1, 2018
scala - google storage transfer job create
View sample.scala
# service-account can call Google StorageTransfer API.
import scala.collection.JavaConversions._
val c = createStorageTransferClient
val j = new TransferJob()
ruseel /
Last active Aug 1, 2018
Google AdSense API with ServiceAccount - Not possible
ruseel /
Last active Mar 16, 2018
spreadsheet.values.append java example
// credential from ServiceAccount json file
GoogleCredential credential = GoogleCredential.fromStream(new FileInputStream(p))
Sheets service = new Sheets.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
AppendValuesResponse r = service.spreadsheets().values().append(
ruseel /
Last active Oct 11, 2017 — forked from clarketm/
How to get Google OAuth 2.0 access token in console using the Python API
#!/usr/bin/env python
This script will attempt to open your webbrowser,
perform OAuth 2.0 authentication and print your access token.
To install dependencies from PyPI:
$ pip install oauth2client
Then run this script: