Skip to content

Instantly share code, notes, and snippets.

# %%
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 March 27, 2022 12:15
Python: Use Whoosh to indexing wordnet and search fields
# %%
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 January 3, 2019 06:40
The unit tests for AllocatingGCMemory
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 05:33
simple blender addon to reload all images
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 April 21, 2017 08:48
Automatically replace the selected layers with original png files based on the layer names
#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 February 25, 2018 15:40
Automatically export selected Photoshop layers based on the layer names;
#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!');
}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using UnityEditor;
using UnityEngine;
/*
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using UnityEditor;
using UnityEngine;
/*