Skip to content

Instantly share code, notes, and snippets.

To transform your Databricks table with columns "28 September, 2023", "04", and "23" into a Databricks date format using SQL, you can use SQL queries within Databricks. You'll need to concatenate the columns to create a string representing the full timestamp and then cast it to a timestamp type. Here's the SQL query to achieve this:

SELECT 
  TO_TIMESTAMP(CONCAT_WS(' ', `28 September, 2023`, `04`, `23`), 'dd MMMM, yyyy HH:mm') AS timestamp_col
FROM
  yourTable;

In this SQL query:

<h1> WOW! </h1>
@rococtz
rococtz / encryption_one_to_many.js
Created September 9, 2021 08:08
encryption_one_to_many
// https://jsbin.com/rasuwilojo/6/edit?js,console
(async () => {
/////////////////////////////////////////////////////////////////
// Instead of logging in with actual users, we are
// going to generate SEA pairs which is basically the same thing
/////////////////////////////////////////////////////////////////
// User 1 encrypts one message
@rococtz
rococtz / simple_encryption.js
Created September 7, 2021 23:33
GUN_ENCRYPTION
///////////////////////////////////
// On my side - logged in as myself
///////////////////////////////////
var myPair = gun.user()._.sea;
// retrieve bob's user
var bob = gun.user(bobPublicKey);
// generate encryption secret using bob's epub and my pair
// this means only bob will be able to generate this secret
var secret = await SEA.secret(bob.epub, myPair)
// encrypt the data using the secret
@rococtz
rococtz / speed_reiceve.html
Created July 20, 2021 23:57
gun-send-receive-test
<html>
<body>
<script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/sea.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/open.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/not.js"></script>
<div id="logger"></div>
@rococtz
rococtz / birds_api.md
Created March 2, 2021 07:49
API Endpoints

Endpoint to retrieve donations

You can currently see this info here: https://www.wrmd.org/reports/generate/donors

Pagination size suggestion: 50

URL: GET /donations?start_date={startDate}&end_date=${endDate}

Response format: JSON

@rococtz
rococtz / dynamo-cheatsheet.md
Last active October 4, 2017 00:55
DynamoDB cheatsheet

Start local instance of DynamoDB

java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb

Connect to database

var AWS = require("aws-sdk");

AWS.config.update({