This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed '1s/.*= //' tweets.js | | |
duckdb -s " | |
SELECT strptime(t->'tweet'->>'created_at', '%a %b %d %H:%M:%S %z %Y') AS created_at, | |
t->'tweet'->>'full_text' AS text, | |
NULLIF(t->'tweet'->>'in_reply_to_status_id', 'null') IS NOT NULL AS is_reply, | |
t->'tweet'->>'in_reply_to_screen_name' AS in_reply_to_screen_name, | |
(t->'tweet'->>'in_reply_to_user_id_str')::bigint AS in_reply_to_user_id_str, | |
(t->'tweet'->>'in_reply_to_status_id')::bigint AS in_reply_to_status_id | |
FROM read_json('/dev/stdin') t | |
WHERE text NOT LIKE 'RT @' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///usr/bin/env jbang "$0" "$@" ; exit $? | |
//JAVA 17 | |
//DEPS org.neo4j:neo4j:5.24.1 | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.util.ArrayList; | |
import java.util.Map; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select year(strptime("Aktivitätsdatum", '%d.%m.%Y, %H:%M:%S')) as year, round(sum(regexp_extract("Aktivitätsbeschreibung", '(\d+(?:\.\d+)*) new kilometer', 1)::double), 2) as new from 'activities.csv' where "Aktivitätsbeschreibung" like '%new kilometers%' group by all order by year; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///usr/bin/env jbang "$0" "$@" ; exit $? | |
//JAVA 17 | |
//DEPS info.picocli:picocli:4.7.5 | |
//DEPS info.picocli:picocli-codegen:4.7.5 | |
//DEPS org.neo4j:neo4j-cypher-dsl-parser:2023.9.7 | |
//DEPS com.opencsv:opencsv:5.9 | |
import java.io.InputStreamReader; | |
import java.nio.file.Files; | |
import java.nio.file.Path; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package demo; | |
import java.util.Map; | |
import java.util.stream.Collectors; | |
import org.neo4j.driver.Driver; | |
public record Movie(String id, String title) { | |
public static final class Repository { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Moved to https://github.com/michael-simons/pv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//usr/bin/env jbang "$0" "$@" ; exit $? | |
//JAVA 17 | |
//DEPS org.neo4j.driver:neo4j-java-driver:5.7.0 | |
//DEPS com.fasterxml.jackson.core:jackson-databind:2.14.1 | |
package ac.simons; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sqlite3 :memory: \ | |
'.mode csv' \ | |
'.import "|curl -s https://gist.githubusercontent.com/zhonglism/f146a9423e2c975de8d03c26451f841e/raw/f79e190df4225caed58bf360d8e20a9fa872b4ac/vgsales.csv" hlp' \ | |
" | |
WITH vgsales AS ( | |
SELECT name, cast(global_sales as number) * 1000000 AS sales, cast(year as number) AS year FROM hlp WHERE year != 'N/A' | |
), | |
per_year AS ( | |
SELECT year, name, sales, dense_rank() OVER (PARTITION BY year ORDER BY sales DESC) AS rnk FROM vgsales | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//usr/bin/env jbang "$0" "$@" ; exit $? | |
//JAVA 17+ | |
//DEPS com.google.googlejavaformat:google-java-format:1.15.0 | |
//RUNTIME_OPTIONS --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED | |
//RUNTIME_OPTIONS --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED | |
//RUNTIME_OPTIONS --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED | |
//RUNTIME_OPTIONS --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED | |
//RUNTIME_OPTIONS --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED | |
import com.google.googlejavaformat.java.Main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//JAVA 17 | |
///usr/bin/env jbang "$0" "$@" ; exit $? | |
//DEPS org.neo4j.driver:neo4j-java-driver:5.2.0 | |
import java.util.List; | |
import org.neo4j.driver.AuthTokens; | |
import org.neo4j.driver.GraphDatabase; | |
// You need to import the Neo4j record, otherwise you will have ambiguous imports | |
import org.neo4j.driver.Record; |
NewerOlder