This file contains hidden or 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
| #!/bin/bash | |
| source /venv/main/bin/activate | |
| COMFYUI_DIR=${WORKSPACE}/ComfyUI | |
| # Packages are installed after nodes so we can fix them... | |
| APT_PACKAGES=( | |
| #"package-1" | |
| #"package-2" |
This file contains hidden or 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
| GEN | |
| elltaniyama(GEN e, long prec) | |
| { | |
| GEN x, w, c, d, X, C, b2, b4; | |
| long n, m; | |
| pari_sp av = avma; | |
| checkell_Q(e); | |
| if (prec < 0) pari_err_DOMAIN("elltaniyama","precision","<",gen_0,stoi(prec)); | |
| if (!prec) retmkvec2(triv_ser(gen_1,-2), triv_ser(gen_m1,-3)); |
This file contains hidden or 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 python | |
| ''' | |
| minimal reference implementation of bitcoin's secp256k1 with general prime field | |
| requires pari && cypari2 for certain operations. | |
| ''' | |
| class EcPoint: | |
| __slots__ = ('x', 'y') | |
| def __init__(self, x, y): |
This file contains hidden or 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
| class memfd_create: | |
| '''create in memory file with actual fileno using memfd_create | |
| usage: | |
| with memfd_create('file_name') as f: | |
| pass # treat f as file-like in binary mode | |
| ''' | |
| import ctypes, os | |
| _libc = ctypes.CDLL(None) | |
| _syscall = _libc.syscall | |
| def __init__(self, name:str): |
This file contains hidden or 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 python | |
| import io | |
| import tarfile | |
| a_content = ''' | |
| content:aaa | |
| content:111 | |
| ''' | |
| b_content = ''' | |
| content:bbb | |
| content:222 |
This file contains hidden or 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
| # binary carry accumulator with O(log(N)) space requirement | |
| # better numerical stability when adding lots of small numbers | |
| class Accumulator: | |
| __slots__ = ('fn', 'data', 'index', 'init') | |
| def __init__(self, size=31, init=0., fn='add'): | |
| if fn == 'mean': | |
| fn=lambda x,wx,y,wy:(x*wx+y*wy)/(wx+wy) | |
| elif fn == 'add': | |
| fn=lambda x,wx,y,wy:x+y | |
| self.fn = fn |
This file contains hidden or 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 os | |
| import sys | |
| import subprocess as subp | |
| if len(sys.argv) != 2: | |
| appname = sys.argv[0] | |
| print('%s - unmount USB directory and power it off' % appname, file=sys.stderr) | |
| print('Usage: %s <directory>' % appname, file=sys.stderr) | |
| sys.exit(-1) |
This file contains hidden or 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
| #include <stdlib.h> | |
| #include <vector> | |
| #include <string> | |
| #include "wstp.h" | |
| using namespace std; | |
| int main() { | |
| int err; | |
| auto env_p = WSInitialize((void*)0); |
This file contains hidden or 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 random import randint | |
| from time import time | |
| import numpy as np | |
| import theano as th | |
| import theano.tensor as T | |
| from theano.tensor.padding import idx, at_idx | |
| N = 256 | |
| x = T.matrix() |
This file contains hidden or 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 itertools import product | |
| from random import randint | |
| from time import time | |
| import numpy as np | |
| import theano as th | |
| T = th.tensor | |
| from theano.tensor.padding import idx, at_idx | |
| from theano.tensor.signal import conv | |
| N = 256 |
NewerOlder