Skip to content

Instantly share code, notes, and snippets.

View clemp's full-sized avatar

Christian Lemp clemp

View GitHub Profile
@clemp
clemp / dClimate ERA5-Land-T Example.ipynb
Last active January 13, 2023 21:41
Example of using finalized or preliminary data for ERA5-Land data
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@clemp
clemp / chainverse_portal_cypher_search.cyp
Created July 26, 2022 20:20
Chainverse Portal Cypher Search Queries
CREATE FULLTEXT INDEX chainversePortalSearchIndex
FOR (n:Note | Partnership | Entity | Proposal)
ON EACH [n.text, n.name, n.body]
# need to modify below query
CALL db.index.fulltext.queryNodes("chainversePortalSearchIndex", $neodash_query) YIELD node
unwind(node) as signal
match (c:Contributor)-[r]-(signal:Signal)-[r1]-(t:Thread)
match (ch:Channel)-[r2]-(t)
return c,r,signal,r1,t,ch,r2
@clemp
clemp / neo4j_fix_properties_from_csv.cyp
Created April 1, 2022 20:35
Neo4j fix property fields of nodes from csv
// one time fix to be run from Neo4j browser
:auto USING PERIODIC COMMIT 1000 LOAD CSV WITH HEADERS from <csv address> as row
MATCH
(a:Article:Mirror)
SET
a.datePublished = datetime(apoc.date.toISO8601(toInteger(row.date_published), 's'))
@clemp
clemp / neo4j_merge_nodes_on_propery.cyp
Last active April 1, 2022 01:52
Merge Neo4j nodes on a property
// Create nodes.
merge (w1:Wallet {address: "0xc75446a6adaef73269dbdece73536977b2b639e0"}) // all lowercase
merge (w2:Wallet {address: "0xC75446A6AdaEF73269dBdEcE73536977B2b639e0"}) // mixed case
merge (w3:Wallet {address: "0x97b9958facec9acb7adb2bb72a70172cb5a0ea7c"}) // all lowercase
merge (w4:Wallet {address: "0x97b9958faceC9ACB7ADb2Bb72a70172CB5a0Ea7C"}) // mixed case
merge (w5:Wallet {address: "0x6989bEB3Fc8842704F05139ba2ED2b1182B3BaC9"}) // mixed case
// Match nodes with same address
MATCH (w:Wallet)
@clemp
clemp / nodejs_neo4j_s3_csv_ingest.js
Created March 25, 2022 20:57
Pattern to ingest data into Neo4j via s3 csvs
const mainTest = async () => {
/*
Configure Neo4j params
*/
const neo4j_params = {
uri: process.env.NEO4J_SANDBOX_URI,
username: process.env.NEO4J_SANDBOX_UN,
pw: process.env.NEO4J_SANDBOX_PW
};
@clemp
clemp / simpy-process.py
Created January 11, 2021 20:16
Using simpy to simulate a workflow
import simpy
import mesa
import random
# A claim arrives every 3 minutes. We'll model this with
# # an exponential distribution and lambda = 1/3
# One team for intake and assignment.
# - Each employee can only work 1 claim at a time.
@clemp
clemp / 3d_pixel_effects.pde
Created March 30, 2020 22:01
3d pixel effects
import peasy.*;
PeasyCam cam;
PImage img;
float[][] reds;
float[][] greens;
float[][] blues;
float progress;
void setup() {
@clemp
clemp / expanding-ellipses.pde
Created March 30, 2020 22:01
Expanding ellipses
int count;
int maxradius = 40;
float growth = 0.6;
// perlin noise incrementer
float xoff;
void setup() {
size(400, 400);
@clemp
clemp / triggering-object-interactions.md
Last active March 24, 2020 17:05
Triggering Object Interactions

Triggering Object Interactions

When objects interact, we can trigger an event or effect to show that an interaction has occurred. We'll use Processing to show how to implement object interactions in a simulation environment.

For this tutorial, we'll create Particle objects (displayed as ellipses) that move around the screen. When two particles come within a certain distance of each other, an ellipse will pulse from the center of each particle. The ellipse will grow to a specified size, then disappear.

First let's create the base Particle class with some physics to move around.

class Particle {
  PVector pos;
@clemp
clemp / seeclickfixr.r
Created February 22, 2014 21:12
Functions to access some of the SeeClickFix data from R
library(RJSONIO)
get_city_issues <- function(city) {
if (!city %in% c("hartford", "new-haven")) {
stop("only works for 'hartford' and 'new-haven' right now")
}
url <- paste("https://seeclickfix.com/api/v2/issues?place_url=", city, "&per_page=100", sep = "")
scf <- readLines(url, warn = F)
scf <- fromJSON(scf)