Skip to content

Instantly share code, notes, and snippets.

View gist:7dd1a847027e36046f3758a257440ad2
# %%
import numpy as np
import torch
import torch.nn as nn
import torch.utils.data as td
# %% [markdown]
# ### Gen data
# %%
@TMPxyz
TMPxyz / gist:8def28453f80dd6f58203551a12983a3
Created Mar 27, 2022
Python: Use Whoosh to indexing wordnet and search fields
View gist:8def28453f80dd6f58203551a12983a3
# %%
import nltk
from nltk.corpus import wordnet2021 as wn
from whoosh.index import create_in, open_dir
from whoosh.fields import *
from tqdm.notebook import tqdm
@TMPxyz
TMPxyz / TestDictionary.cs
Created Jan 3, 2019
The unit tests for AllocatingGCMemory
View TestDictionary.cs
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using NUnit.Framework;
using UnityEngine.Profiling;
using UnityEngine.TestTools.Constraints;
using Is = UnityEngine.TestTools.Constraints.Is;
@TMPxyz
TMPxyz / reload_all_image.py
Created May 3, 2017
simple blender addon to reload all images
View reload_all_image.py
bl_info = {
"name": "Reload All Images",
"author": "tmpxyz",
"version": (1, 0),
"blender": (2, 72, 2),
#"location": "View3D > Toolbar and View3D > Specials (W-key)",
"warning": "",
"description": "reload all images",
"category": "image",
}
@TMPxyz
TMPxyz / AutoUpdateSelectedLayers.jsx
Last active Apr 21, 2017
Automatically replace the selected layers with original png files based on the layer names
View AutoUpdateSelectedLayers.jsx
#target photoshop
// debug level: 0-2 (0:disable, 1:break on error, 2:break at beginning)
// $.level = 0;
// debugger; // launch debugger on next line
app.activeDocument.suspendHistory("AutoUpdateSelectedLayers", "main()");
///////////////////////////////////////////////////////////////////////////////
// Functions
@TMPxyz
TMPxyz / AutoExportSelectedLayers.jsx
Last active Feb 25, 2018
Automatically export selected Photoshop layers based on the layer names;
View AutoExportSelectedLayers.jsx
#target photoshop
// debug level: 0-2 (0:disable, 1:break on error, 2:break at beginning)
// $.level = 0;
// debugger; // launch debugger on next line
if (app.documents.length <= 0) {
if (DialogModes.NO != app.playbackDisplayDialogs) {
alert('no document is opened!');
}
View SaveFBX.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using UnityEditor;
using UnityEngine;
/*
View SaveFBX.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using UnityEditor;
using UnityEngine;
/*