Skip to content

Instantly share code, notes, and snippets.

View ar-puuk's full-sized avatar
💭
💩🚗

Pukar Bhandari ar-puuk

💭
💩🚗
View GitHub Profile
library(sf)
#> Linking to GEOS 3.13.1, GDAL 3.11.4, PROJ 9.7.0; sf_use_s2() is TRUE
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
library(bench)
library(dplyr)
library(arrow)
library(polars)
library(duckdb)
# 1. Define Paths
csv_path <- "C:/Users/Pukar.Bhandari/Downloads/REMM_Parcels_2023.csv"
parquet_path <- "C:/Users/Pukar.Bhandari/Downloads/REMM_Parcels_2023.parquet"
@ar-puuk
ar-puuk / get_data_context.R
Last active January 24, 2026 04:10
Generates a high-fidelity YAML-formatted summary of a DataFrame for LLMs
library(tidyverse)
library(jsonlite)
get_data_context <- function(df) {
rows <- nrow(df)
cols <- ncol(df)
# 1. Detect Object Type(s)
# Returns something like "sf, tbl_df, tbl, data.frame"
obj_class_full <- class(df)
if (!require("rvest")) install.packages("rvest")
if (!require("xml2")) install.packages("xml2")
if (!require("httr2")) install.packages("httr2")
library(rvest)
library(xml2)
library(httr2)
# 1. Dynamic Download Path
# Tries to find Windows User Profile first, falls back to generic HOME
library(tidyverse)
library(tidycensus)
library(mapgl)
library(spopt)
library(sf)
library(spdep)
options(tigris_use_cache = TRUE)
project_crs <- "EPSG:26912" # NAD83 / Utah North
@ar-puuk
ar-puuk / ArcGIS_Server_Mirror.R
Last active January 2, 2026 00:52
An R Script to mirror ArcGIS Rest Service using sitemap
# install.packages(c("sf", "arcgislayers", "xml2", "dplyr", "stringr", "purrr", "httr2"))
library(sf)
library(arcgislayers)
library(xml2)
library(dplyr)
library(stringr)
library(purrr)
library(httr2)
# Configuration
@ar-puuk
ar-puuk / batch-convert-geojson.R
Last active December 8, 2025 16:59
Script to batch process geojson files to parquet with CRS metadata.
setwd("D:/GitHub/MAP-Housing-ATO-Calculator-Updated")
library(fs)
library(sf)
library(arrow)
library(here)
library(purrr)
library(jsonlite)
here::here()
# Day 27: Boundaries - World Time Zones (Original Colors, Dynamic Time)
# Shows current time in each timezone, colors based on local time of day
# Uses original hex palette: Blue (Midnight) -> White (Dawn/Dusk) -> Brown (Noon)
library(mapgl)
library(sf)
library(dplyr)
library(lubridate)
# Get user's current timezone and time
# DuckDB Vector Tiles with mapgl Example
# This script demonstrates how to serve vector tiles from DuckDB using ST_AsMVT()
# and display them in a mapgl map using httpuv
library(mapgl)
library(duckdb) # Requires the latest DuckDB version (>= 1.4.0)
library(httpuv)
library(sf)
library(duckspatial)
library(tigris)
@ar-puuk
ar-puuk / defaultSetings.jsonc
Last active March 3, 2026 20:29
Positron Setup
{
// General
// Create a debug channel in the Output view.
"todo-tree.general.debug": false,
// Set to true to enable automatic updates when files in the workspace are created, changed or deleted.
"todo-tree.general.enableFileWatcher": false,
// Path to use when exporting the tree. Environment variables will be expanded, e.g `${HOME}` and the path is passed through strftime (see <https://github.com/samsonjs/strftime>). Set the extension to `.json` to export as a JSON record.
"todo-tree.general.exportPath": "~/todo-tree-%Y%m%d-%H%M.txt",