Skip to content

Instantly share code, notes, and snippets.

View danpaldev's full-sized avatar

Daniel danpaldev

View GitHub Profile
@danpaldev
danpaldev / mmd_model_ortho_camera.html
Created May 16, 2024 00:52
mmd_model_ortho_camera
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - loaders - MMD loader</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link type="text/css" rel="stylesheet" href="main.css">
<style>
body {
background-color: #fff;
@danpaldev
danpaldev / mmd_loader.html
Created May 11, 2024 05:53
mmd_loader.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - loaders - MMD loader</title>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
/>
<link type="text/css" rel="stylesheet" href="main.css" />
@danpaldev
danpaldev / redis_generate_dump.py
Created June 8, 2023 21:23
Redis Backup Scripts
import redis
import csv
csv_file_path = 'metrics_output.csv'
r = redis.Redis(host='localhost', port=6380, decode_responses=True)
def insert_into_sorted_set(sorted_set_name, timestamp, metric):
try:
@danpaldev
danpaldev / metrics_backend.py
Last active June 8, 2023 21:58
Fetching Metrics on the backend
#Django Endpoint
from .redis_client import redis_client
#...
#...
#POST ${HOST}/metrics
#REQUEST BODY: {models: [], timestamps: {start: 1111, end: 2222}}
class MetricsView():
def post(self, request):
@danpaldev
danpaldev / metrics_cron.py
Last active June 8, 2023 21:16
openplayground-metrics-cron
import json
import sseclient
import requests
from models_schema import models
from pprint import pformat
import time
import redis
import logging
logging.basicConfig(filename='metrics_cron.log', level=logging.INFO,
@danpaldev
danpaldev / main.tf
Created September 22, 2022 14:54
Terraform infra
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.16"
}
}
required_version = ">= 1.2.0"
}
@danpaldev
danpaldev / Dockerfile
Created April 12, 2021 23:35 — forked from and-pete/Dockerfile
Multi-Stage Docker Build for a Haskell (Stack) Project
# The below is a combination of the following two things:
# 1) This article + corresponding Gist: https://medium.com/permutive/optimized-docker-builds-for-haskell-76a9808eb10b
# 2) This Reddit comment in response to the above:
# - https://www.reddit.com/r/haskell/comments/cl5uod/optimized_docker_builds_for_haskell/evuzccm/
# It is a multi-stage Docker build with 3 stages: 1) dependencies, 2) build, and 3) deploy
# -------------------------------------------------------------------------------------------
# STAGE 1: Dependencies
# -------------------------------------------------------------------------------------------
FROM haskell:8.10.2 as dependencies
@danpaldev
danpaldev / Every possible TypeScript type.md
Created December 21, 2020 20:35 — forked from laughinghan/Every possible TypeScript type.md
Diagram of every possible TypeScript type

Hasse diagram of every possible TypeScript type

  • any: magic, ill-behaved type that acts like a combination of never (the proper [bottom type]) and unknown (the proper [top type])
    • Anything at all is assignable to any, and any is assignable to anything at all.
    • Identities: any & AnyTypeExpression = any, any | AnyTypeExpression = any
    • Key TypeScript feature that allows for [gradual typing].
  • unknown: proper, well-behaved [top type]
    • Anything at all is assignable to unknown. unknown is only assignable to itself (unknown) and any.
    • Identities: unknown & AnyTypeExpression = AnyTypeExpression, unknown | AnyTypeExpression = unknown
  • Prefer over any whenever possible. Anywhere in well-typed code you're tempted to use any, you probably want unknown.
@danpaldev
danpaldev / .README.md
Created December 16, 2020 21:11 — forked from YumaInaura/.README.md
Mac — Replace clipboard text with regex in console

Mac — Replace clipboard text with regex in console

I noticed today.

We can edit Mac's clipboad directly by pbcopy and pbpaste commands combination.

pbpaste | sed 's/Bob//g' | pbcopy
@danpaldev
danpaldev / About.md
Last active October 9, 2020 17:27 — forked from derlin/DockerCassandra-InitDb.md
Dockerfile and entrypoint example in order to easily initialize a Cassandra container using *.sh/*.cql scripts in `/docker-entrypoint-initdb.d`

Initializing a Cassandra Docker container with keyspace and data

This gist shows you how to easily create a cassandra image with initial keyspace and values populated.

It is very generic: the entrypoint.sh is able to execute any cql file located in /docker-entrypoint-initdb.d/, a bit like what you do to initialize a MySQL container.

You can add any *.sh or *.cql scripts inside /docker-entrypoint-initdb.d, but note that:

  • *.sh files will be executed BEFORE launching cassandra