Skip to content

Instantly share code, notes, and snippets.

@emailandxu
emailandxu / SMPL_FRAMES_ADDON.py
Created March 26, 2024 10:15
Animate for mdm frames obj
bl_info = {
"name": "MY_SMPL_FRAMES_ANIMATION",
"blender": (4, 0, 0),
"category": "Object",
}
import bpy
import os
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import torch
import numpy as np
from matplotlib import pyplot as plt
TARGET = 2.7
LR = 1
l1 = lambda hypo, target: (hypo - target).abs()
l2 = lambda hypo, target: (hypo - target) ** 2
weights_init = torch.ones(1, 4) + torch.rand(1, 4)
@emailandxu
emailandxu / blender_viewport_to_image_per_view.py
Created November 20, 2023 09:50
render per view of blender viewport to a image very fast
#from this: https://blender.stackexchange.com/a/231881
import bpy
import gpu
# Draw function which copies data from the 3D View
def draw(self, context):
if self.modal_redraw == True:
@emailandxu
emailandxu / dhcpclient.py
Created April 10, 2023 04:41
DHCP Debugging Scapy Scripts
import random
from scapy.all import *
# Function to generate a random MAC address
def random_mac():
return "02:%02x:%02x:%02x:%02x:%02x" % (
random.randint(0, 255),
random.randint(0, 255),
random.randint(0, 255),
random.randint(0, 255),
@emailandxu
emailandxu / GitConfigHttpProxy.md
Created October 17, 2022 07:49 — forked from evantoli/GitConfigHttpProxy.md
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@emailandxu
emailandxu / AnimationExtractor.cs
Created October 8, 2022 08:45
How to create .anim file from .fbx file in Unity?
//source from: https://stackoverflow.com/a/68178683/19835902
using System.IO;
using UnityEditor;
using UnityEngine;
public class AnimationExtractor: MonoBehaviour
{
[MenuItem("Assets/Extract Animation")]
private static void ExtractAnimation()
@emailandxu
emailandxu / check_cert.py
Created September 8, 2022 07:06
print and validate ssl certificate
import os, ssl, certifi
# adress
host, port = "baidu.com", "443"
# the ca relative path
ca_certs=os.path.relpath(certifi.where())
# Retrieve the server certificate, validate the certificate by specify the ca_certs arg
cert = ssl.get_server_certificate((host, port), ca_certs=ca_certs)
# print the cert
print(cert)
#%%
import numpy as np
from hmmlearn import hmm
#%%
states = ["Rainy", "Sunny"]
n_states = len(states)
observations = ["walk", "shop", "clean"]
n_observations = len(observations)