Skip to content

Instantly share code, notes, and snippets.

View ries9112's full-sized avatar

ries9112

View GitHub Profile
@ries9112
ries9112 / 3d_ride.R
Created January 2, 2020 18:48 — forked from slopp/3d_ride.R
Code to make pretty bike ride plots with rayshader and rStrava
source("helpers.R")
plot_3d_route_area <- function(stream, zscale = 15){
# create bounding box for the ride
ui("1 of 5: Locating Route...")
bbox <- list(
p1 = list(long = min(stream$lng), lat = min(stream$lat)),
p2 = list(long = max(stream$lng), lat = max(stream$lat))
)
@ries9112
ries9112 / pull_hicetnunc_data.R
Created March 30, 2021 03:28
R script to pull data from hicetnunc
library(pacman)
# Load packages
p_load('pins')
# Register Board for data pull
board_register("https://raw.githubusercontent.com/predictcrypto/pins/master/","pins_repo")
# Pull data
stats_hicetnunc <- pin_get("stats_hicetnunc", "pins_repo")
@ries9112
ries9112 / gist:450f9309cbb25768298d698d31e69537
Created June 6, 2021 16:48
Use this query to find all objkts in your collection - sorted by highest sales (both primary and secondary market). Replace 'String = "tz1c...' with your own Tezos wallet.
query findSecondarySales($address: String = "tz1c2iwyckUCcicx2qxqtwLEartYFEHg1pvB") {
hic_et_nunc_swap(where: {status: {_in: [1]}, token: {swaps: {trades: {buyer: {address: {_eq: $address}}}}}}, order_by: {price: desc}) {
price
status
token {
title
mime
description
id
artifact_uri
@ries9112
ries9112 / hen_graphql_query.R
Last active June 6, 2021 19:36
An example of pulling data from the hic et nunc GraphQL endpoint by @marchingsquare into the R programming language for further manipulation
library(ghql)
library(jsonlite)
# Address to lookup:
address = "tz1c2iwyckUCcicx2qxqtwLEartYFEHg1pvB"
# connect to the endpoint
con <- GraphqlClient$new(
url = "https://api.hicdex.com/v1/graphql"
)
@ries9112
ries9112 / graphql_hen_example
Last active June 19, 2021 00:40
This is an example of using the GraphQL endpoint by @marchingsquare. This example gets data for John Karel address and finds objkts with certain tags (loose match with 'like'). Try copy/pasting this example into this editor: https://api.hicdex.com/graphiql/
query collectorGallery($address: String = "tz1gqaKjfQBhUMCE6LhbkpuittRiWv5Z6w38") {
hic_et_nunc_token(where: {trades: {buyer: {address: {_eq: $address}}}, _and: {token_tags: {tag: {tag: {_like: "jjjjjjjjjjohn"}}, _or: {token: {token_tags: {tag: {tag: {_like: "window"}}}}}}}}, order_by: {id: asc}) {
id
artifact_uri
thumbnail_uri
timestamp
mime
title
description
supply
@ries9112
ries9112 / CV_pull_recent_audio_objkts
Created June 30, 2021 04:22
This is Ricky's CV script of the gallery that displays the most recent artwork from hic et nunc (https://www.cryptovoxels.com/play?coords=SE@6922W,34S). This is an adaptation where the GraphQL query returns data for audio objkts (as requested by @Mighty_33)
feature.on('click',e=>{
fetch('https://api.hicdex.com/v1/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: `
query MyQuery {
@ries9112
ries9112 / CV_archive_tx_id
Last active July 23, 2021 14:45
Query to find CryptoVoxels Archives. Copy/paste into https://arweave.net/graphql
query {
transactions(
tags: [
{
name: "Content-Type",
values: ["application/zip"]
},
{
name: "Tag-Name",
values: ["CryptoVoxelsArchive"]
@ries9112
ries9112 / Plot objkt4objkt tag sales - HEN
Last active September 5, 2021 13:01
You can run this code at any time to view the cumulative sales over time of objkts with the "objkt4objkt" tag
library(ghql)
library(jsonlite)
library(tidyverse)
library(ggdark)
library(ggfx)
library(scales)
# Tag to lookup:
tag = "objkt4objkt"
@ries9112
ries9112 / plot_by_artist.R
Created September 5, 2021 19:27
Plot cumulative sales in Tezos for your favorite HEN artist
library(ghql)
library(jsonlite)
library(tidyverse)
library(ggdark)
library(ggfx)
library(scales)
# Tag to lookup:
artist = "tz2Pkj2xWJovKKCsABjnr3NbyMVJTMBkpTvb"
@ries9112
ries9112 / flexdashboard_hicdex_lookup
Created September 5, 2021 20:39
A dashboard to plot cumulative sales over time for either an artist or a given tag: https://predictcrypto.shinyapps.io/HEN_lookup/
---
title: "HEN Data Lookup"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
theme: spacelab
source_code: embed
social: ['twitter','facebook','linkedin']
runtime: shiny