This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
N_inp = 64 | |
N_out = 64 | |
d = 128 | |
Q = np.random.randn(N_out, d) | |
K = np.random.randn(N_inp, d) | |
V = np.random.randn(N_inp, d) | |
O = np.random.randn(N_out, d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from threading import Barrier, Thread | |
from collections import namedtuple | |
dim3 = namedtuple("dim3", ["x", "y", "z"], defaults=(1, 1)) | |
TILE = 16 | |
def cdiv(a, b): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import re | |
from pathlib import Path | |
from typing import List | |
MARK = "// -----// IR Dump" | |
PAT = re.compile(r'IR Dump \w+ (\w+)') | |
def main(infile: Path, outdir: Path): | |
assert infile.exists(), f'{infile} not exists' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name adventofcode daylight mode | |
// @namespace Violentmonkey Scripts | |
// @match https://adventofcode.com/* | |
// @grant none | |
// @version 1.0 | |
// @author scturtle | |
// @description 2023/11/27 16:52:13 | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ubuntu/debian | |
# sudo apt install libjansson-dev texinfo gnutls-bin | |
# homebrew | |
brew install jansson texinfo | |
# build | |
CFLAGS="-O2 -DNDEBUG" ./configure \ | |
--without-all --without-x --without-ns --without-libgmp \ | |
--with-json --with-modules --with-threads \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# coding: utf-8 | |
import os,socket,threading,time | |
#import traceback | |
allow_delete = False | |
local_ip = socket.gethostbyname(socket.gethostname()) | |
local_port = 8888 | |
currdir=os.path.abspath('.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset=utf-8> | |
<title>WebSocket test</title> | |
</head> | |
<body> | |
<script> | |
if (window.MozWebSocket) { | |
window.WebSocket = window.MozWebSocket; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import os | |
#书籍信息 | |
title='test book' | |
creator='scturtle' | |
description='blablablabla' | |
#章节文件 | |
txtlist=['1.txt','2.txt'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from deap import base, creator, tools, algorithms | |
from random import randint, random, gauss | |
from PIL import Image, ImageDraw | |
from functools import partial | |
from math import sqrt | |
import numpy | |
PIC = Image.open('head.jpg') | |
SIZE = 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import time | |
import random | |
import struct | |
import urllib.request | |
from pathlib import Path | |
# https://www.amiiboapi.com/api/amiibo/ | |
database = json.load(open("amiibos.json")) |
NewerOlder