Skip to content

Instantly share code, notes, and snippets.

View MarkEdmondson1234's full-sized avatar
🦑
Tappity tap tap

Mark Edmondson MarkEdmondson1234

🦑
Tappity tap tap
View GitHub Profile
@jboner
jboner / latency.txt
Last active April 19, 2024 23:08
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
import os
import autogen
import memgpt.autogen.memgpt_agent as memgpt_autogen
import memgpt.autogen.interface as autogen_interface
import memgpt.agent as agent
import memgpt.system as system
import memgpt.utils as utils
import memgpt.presets as presets
import memgpt.constants as constants
import memgpt.personas.personas as personas
@Bilka2
Bilka2 / webhook.py
Last active April 8, 2024 15:49
Simple discord webhook with python
import requests #dependency
url = "<your url>" #webhook url, from here: https://i.imgur.com/f9XnAew.png
#for all params, see https://discordapp.com/developers/docs/resources/webhook#execute-webhook
data = {
"content" : "message content",
"username" : "custom username"
}
@datawookie
datawookie / unicode symbols
Last active April 8, 2024 15:29
Useful Unicode characters
https://github.com/muan/unicode-emoji-json
° — degree
× — times
💣 — bomb
💥 — explosion
🔥 — fire
🎉 — tada
🧯 — fire extinguisher
@krisjan-oldekamp
krisjan-oldekamp / google_analytics_bigquery_user_mapping_table_customer.sql
Last active February 26, 2024 08:52
How to create a user mapping table (or Identity Graph) based on all the available user identifiers in the Google Analytics 4 BigQuery exports (like device-IDs or customer-IDs). Full article on stacktonic.com
-- Author: Krisjan Oldekamp
-- https://stacktonic.com/article/create-a-user-mapping-table-based-on-the-google-analytics-4-big-query-dataset
declare lookback_window int64 default 90; -- how many days to lookback into the dataset to search for ids (compared to today)
-- udf: deduplicate array of struct
create temp function dedup(arr any type) as ((
select
array_agg(t)
from (
@wch
wch / app.r
Last active December 18, 2023 16:41
Shiny example app with dynamic number of plots
max_plots <- 5
ui <- fluidPage(
headerPanel("Dynamic number of plots"),
sidebarPanel(
sliderInput("n", "Number of plots", value=1, min=1, max=5)
),
@hrbrmstr
hrbrmstr / orig.png
Last active July 16, 2023 06:43
Supreme Annotations - moar splainin here: http://rud.is/b/2016/03/16/supreme-annotations/ - NOTE: this requires the github version of ggplot2
orig.png
@mjul
mjul / Dockerfile
Created June 2, 2016 08:53
Running R scripts in a Docker container
FROM r-base:latest
COPY . /usr/local/src/myscripts
WORKDIR /usr/local/src/myscripts
CMD ["Rscript", "myscript.R"]
# This example demonstrates running furrr code distributed on 2 AWS instances ("nodes").
# The instances have already been created.
library(future)
library(furrr)
# Two t2.micro AWS instances
# Created from http://www.louisaslett.com/RStudio_AMI/
public_ip <- c("34.205.155.182", "34.201.26.217")
@raymondben
raymondben / global.R
Last active September 19, 2022 19:24
gauth shiny example
library(googleAuthR)
library(shiny)
library(shinyjs)