Skip to content

Instantly share code, notes, and snippets.

View danpaldev's full-sized avatar

Daniel danpaldev

View GitHub Profile
danpaldev / mmd_model_ortho_camera.html
Created May 16, 2024 00:52
<!DOCTYPE html>
<html lang="en">
<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">
body {
background-color: #fff;
danpaldev / mmd_loader.html
Created May 11, 2024 05:53
<!DOCTYPE html>
<html lang="en">
<title>three.js webgl - loaders - MMD loader</title>
<meta charset="utf-8" />
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 /
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):
danpaldev /
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 /
Last active June 8, 2023 21:16
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 /
Created September 22, 2022 14:54
Terraform infra
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.16"
required_version = ">= 1.2.0"
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:
# 2) This Reddit comment in response to the above:
# -
# 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 / Every possible TypeScript
Created December 21, 2020 20:35 — forked from laughinghan/Every possible TypeScript
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 /
Created December 16, 2020 21:11 — forked from YumaInaura/
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 /
Last active October 9, 2020 17:27 — forked from derlin/
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 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