Skip to content

Instantly share code, notes, and snippets.

@ishikawash
ishikawash / out.log
Created September 9, 2014 15:16
toxiclibs: Quaternion error
{axis: [0.0,0.7078125,0.0], w: 0.70781255}
{axis: [0.0,-0.70922744,0.0], w: 0.7064004}
@ishikawash
ishikawash / nuxi-problem.cpp
Created August 26, 2020 03:56
The NUXI Problem
#include <iostream>
int main()
{
char text[] = { 'U', 'N', 'I', 'X' };
uint16_t* p = reinterpret_cast<uint16_t*>(text);
for (int i = 0; i < sizeof(text)/sizeof(uint16_t); i++)
{
uint16_t a = *p;
@ishikawash
ishikawash / window_activation.py
Created May 11, 2021 12:52
Activate window by process ID in Python
# ref: https://sjohannes.wordpress.com/tag/win32/
from __future__ import print_function
import ctypes
from ctypes import windll
import sys
Win32 = windll.user32
EnumWindowsProc = ctypes.WINFUNCTYPE(ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int))
@ishikawash
ishikawash / fibo_num_sequence.py
Created June 26, 2021 02:59
Fibonacci number calculation with Python generator and QTimer.
import sys
import enum
from PySide2 import QtCore
from PySide2.QtWidgets import QApplication, QWidget, QMainWindow, QLabel, QPushButton, QVBoxLayout
def fibo():
a = 0
b = 1
while True:
c = a + b
@ishikawash
ishikawash / cnn_example.py
Last active August 26, 2025 11:54
Pytorch: CNN example
import timeit
import itertools
from pathlib import Path
from dataclasses import dataclass
from argparse import ArgumentParser
import torch
from torch import nn
import torchvision
import torchvision.transforms as transforms
from torch.utils.data import DataLoader