Skip to content

Instantly share code, notes, and snippets.

View watosar's full-sized avatar

watosar watosar

  • Japan
View GitHub Profile
@watosar
watosar / .gitignore
Created January 5, 2024 19:12
django admin mock
‎‎​
@watosar
watosar / juliaset.jl
Created April 19, 2021 15:31
CUDA OpenGL4.6 Interop in Julia Lang: julia set
module Draw
import GLFW
using ModernGL
using CUDA
using CUDA: cuGraphicsGLRegisterBuffer,
CUgraphicsResource,
cuGraphicsMapResources,
CUdeviceptr,
module HelloTriangle
export App, run
using VulkanCore.LibVulkan
import GLFW
const GLFW_CLIENT_API = 0x00022001
const GLFW_NO_API = 0
const GLFW_FALSE = 0
module Lexrank
using LinearAlgebra
using PyCall
fugashi = pyimport("fugashi")
const LemmaINDEX = 8
function Summarize(document::T where T<:AbstractString; threshold=0.3)
splited_document = Tuple(
@watosar
watosar / cube_wave.metal
Last active June 21, 2020 22:05
cube_wave.metal
/*
# set some configs
[Editor]
timer_limit = 6.283
fps = 60
[Vertex]
count = 4
type = 4
*/
@watosar
watosar / revive_searchoptions.py
Last active February 14, 2020 02:32
revive extra search options feature on Pythonista.
from objc_util import *
from objc_util import parse_types
import ctypes
import editor
import time
method_exchangeImplementations=c.method_exchangeImplementations
method_exchangeImplementations.restype=None
method_exchangeImplementations.argtypes=[c_void_p,c_void_p]
@watosar
watosar / objc_class.py
Created February 9, 2020 01:02
objc_util.create_objc_class wrapper
from objc_util import create_objc_class, ObjCInstance, NSObject
from textwrap import dedent
def objci_new_setattr(self, name, value):
if name in ('ptr', 'weakrefs', '_cached_methods', '_as_parameter_'):
self.__dict__[name] = value
return
try:
setter_method = getattr(self, 'set%s%s_' % (name[0].upper(), name[1:]))
setter_method(value)
from objc_util import *
from ctypes import *
from pathlib import Path
import ui
IOMobileFramebufferOpen = c.IOMobileFramebufferOpen
IOMobileFramebufferOpen.argtypes = [c_void_p]*4
mach_task_self = c.mach_task_self
@watosar
watosar / factorial.py
Last active May 5, 2019 03:22
ワンライナー
print([next(_ for _ in ((0for _return, _args in iter({'_return':[None], 'args':[]}.values,None)if _args.append((yield _return[0])) or (([[0 for f,*_ in (_args,)for _return[0] in(f()(f,5)[0],)]] and _args.clear()) if _args else None)),) if [next(_)]).send(functools.partial(next,(type('funcsource',tuple(),next(namespace for namespace in ({'_return': ['return']},)for _func in (next(_ for _ in ((0for count, _args in iter({'argcount':2+2, 'args':[]}.values,None)if _args.append((yield (1 if (_args and _args[-1] is namespace['_return']) else 0))) or (([[0 for self, _, f,n in (_args,)for __ in (self._return.clear(),)if self._return.append(1 if n ==1 else f()(f,n-1)[0]*n)]] and _args.clear()) if len(_args)>=count else None)),) if [next(_)]).send,)for namespace['__call__'] in (functools.partialmethod(max,namespace.get('_return'),key = _func),)))() for i in iter(int,1)))) for functools in (__import__('functools'),)][0])
@watosar
watosar / README.md
Last active May 5, 2019 03:23
ワンライナー関数

ワンライナー(lambda無し)