An introduction to curl using GitHub's API
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
| Go to Bitbucket and create a new repository (its better to have an empty repo) | |
| git clone git@bitbucket.org:abc/myforkedrepo.git | |
| cd myforkedrepo | |
| Now add Github repo as a new remote in Bitbucket called "sync" | |
| git remote add sync git@github.com:def/originalrepo.git | |
| Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync" | |
| git remote -v |
| // WARNING! totally untested, I have only compiled the code! :) | |
| package json | |
| import collection.immutable.Map | |
| import scalaz.{\/, MonadPlus} | |
| import scalaz.\/._ | |
| import scalaz.std.vector._ | |
| import scalaz.std.map._ | |
| import scalaz.std.list._ |
| #!/usr/bin/env python3 | |
| # | |
| # Query AWS Athena using SQL | |
| # Copyright (c) Alexey Baikov <sysboss[at]mail.ru> | |
| # | |
| # This snippet is a basic example to query Athen and load the results | |
| # to a variable. | |
| # | |
| # Requirements: | |
| # > pip3 install boto3 botocore retrying |
| scala> val df = spark.read.option("mergeSchema", "true").parquet("/Users/saswatdutta/playground/df/df3/*"); df.printSchema | |
| root | |
| |-- id: long (nullable = true) | |
| |-- created_at: long (nullable = true) | |
| df: org.apache.spark.sql.DataFrame = [id: bigint, created_at: bigint] | |
| scala> val df = spark.read.option("mergeSchema", "true").parquet("/Users/saswatdutta/playground/df/df1/*"); df.printSchema | |
| root | |
| |-- id: long (nullable = true) |
| // ... | |
| Request request = new Request.Builder() | |
| .url(url) | |
| .tag(TAG) | |
| .build(); | |
| // Cancel previous call(s) if they are running or queued | |
| OkHttpUtils.cancelCallWithTag(client, TAG); | |
| // New call |
| # -*- coding: utf-8 -*- | |
| import avro.schema | |
| def get_schema_children(avro_schema): | |
| children = [] | |
| if isinstance(avro_schema, avro.schema.UnionSchema): | |
| children = avro_schema.schemas | |
| if isinstance(avro_schema, avro.schema.RecordSchema): |
| /** GADTs in Scala and their limitations */ | |
| /** Background: what is an algebraic data type (ADT) ? | |
| * ADT: (possibly) recursive datatype with sums and products | |
| * In scala - a trait with case classes (case class is product, subtyping is sum) | |
| */ | |
| /** Motivation: untyped embedded DSL doesn't prevent nonsensical expressions */ | |
| sealed trait Expr { | |
| def apply(other: Expr) = Ap(this, other) |
| // The expression problem is a new name for an old problem. The goal is to | |
| // define a datatype by cases, where one can add new cases to the datatype and | |
| // new functions over the datatype, without recompiling existing code, and while | |
| // retaining static type safety (e.g., no casts). | |
| // (Philip Wadler) | |
| import scala.language.implicitConversions | |
| object ExpressionProblem extends App { |
An introduction to curl using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin