Skip to content

Instantly share code, notes, and snippets.

View nicosuave's full-sized avatar

Nico Ritschel nicosuave

View GitHub Profile
@nicosuave
nicosuave / sql_ls.py
Created January 25, 2025 22:10 — forked from z3z1ma/sql_ls.py
A simple language server implementation for SQLMesh using PyGLS
#!/usr/bin/env python
"""A Language Server Protocol (LSP) server for SQL with SQLMesh integration."""
import asyncio
import gc
import io
import logging
import re
import typing as t
import weakref
@nicosuave
nicosuave / create_url_encode.sql
Last active December 1, 2024 05:59
DuckDB url_encode
CREATE OR REPLACE MACRO url_encode(input_string) AS (
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
replace(
@nicosuave
nicosuave / request-body.json
Created November 3, 2024 19:10 — forked from ianmcook/request-body.json
Use the Snowflake SQL REST API from a shell script with curl and jq to execute a query and download the result partitions in Arrow format
{
"statement": "SELECT * FROM MYTABLE",
"resultSetMetaData": {
"format": "arrowv1"
},
"timeout": 60,
"database": "MYDATABASE",
"schema": "MYSCHEMA",
"warehouse": "MYWAREHOUSE",
"role": "MYROLE"
Package Version
-------------------------- -----------
absl-py 2.1.0
ace-tools 0.0.1
aeppl 0.0.31
aesara 2.7.3
affine 2.4.0
aiohttp 3.8.6
aiosignal 1.3.1
analytics-python 1.4.post1
@nicosuave
nicosuave / trips.csv
Created July 16, 2024 17:28
citibike data sample
We can't make this file beautiful and searchable because it's too large.
ride_id,rideable_type,started_at,ended_at,start_station_name,start_station_id,end_station_name,end_station_id,start_lat,start_lng,end_lat,end_lng,member_casual,distance_km
DAE3C13A5FAAB089,classic_bike,2023-12-29 16:02:20,2023-12-29 16:10:17,Brunswick St,JC023,Communipaw & Berry Lane,JC084,40.72401619,-74.050550103,40.71435836870427,-74.06661093235016,member,1.7278187234240936
1EC6BE46ACF2DE11,classic_bike,2023-12-06 01:58:32,2023-12-06 02:04:48,Brunswick St,JC023,Oakland Ave,JC022,40.724134684,-74.050686002,40.7376037,-74.0524783,casual,1.5052812734284393
105CA439B9CBF57C,classic_bike,2023-12-06 20:15:11,2023-12-06 20:21:02,Brunswick St,JC023,Oakland Ave,JC022,40.72399044,-74.050639033,40.7376037,-74.0524783,member,1.5216384126570526
DC1C46F6090FA1DB,classic_bike,2023-12-09 13:54:19,2023-12-09 13:56:48,Brunswick St,JC023,Manila & 1st,JC082,40.723983169,-74.050732374,40.72165072487999,-74.04288411140442,casual,0.7104214646715642
@nicosuave
nicosuave / zoomer_boomer_translator.js
Last active November 25, 2023 08:17
Zoomer Boomer Tweet Translate
// ==UserScript==
// @name Zoomer/Boomer Speak Converter
// @version 0.1
// @description Translate tweets to zoomer or boomer speak with enhanced UI, response handling, and retry mechanism
// @author Nico Ritschel
// @match *://twitter.com/*
// @grant GM_xmlhttpRequest
// ==/UserScript==
(function() {
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nicosuave
nicosuave / results.MD
Created July 26, 2023 03:29
DuckDB Benchmarks RockPi 5 Plus vs MacBook Pro M2 Max

First up, the RockPi 5 Plus

Append100KIntegersINSERT	1	17.186225
Append100KIntegersINSERT	2	17.100570
Append100KIntegersINSERT	3	17.116827
Append100KIntegersINSERT	4	17.086158
Append100KIntegersINSERT	5	16.995595
Append100KIntegersINSERTDisk	1	16.979044
Append100KIntegersINSERTDisk	2	16.988265

Keybase proof

I hereby claim:

  • I am nicosuave on github.
  • I am nicosuave (https://keybase.io/nicosuave) on keybase.
  • I have a public key ASA5dKEUzFsSLC8ZLRTPqgn83M0P6ohOlfX5x_W1HSs_Kgo

To claim this, I am signing this object:

@nicosuave
nicosuave / Schema2CaseClass.scala
Created October 5, 2017 04:07 — forked from yoyama/Schema2CaseClass.scala
Generate case class from spark DataFrame/Dataset schema.
/**
* Generate Case class from DataFrame.schema
*
* val df:DataFrame = ...
*
* val s2cc = new Schema2CaseClass
* import s2cc.implicit._
*
* println(s2cc.schemaToCaseClass(df.schema, "MyClass"))
*