Skip to content

Instantly share code, notes, and snippets.

View kice's full-sized avatar

kice

  • The Land of HiRes Anime
View GitHub Profile
@kice
kice / bandwidthd.widget.php
Last active November 14, 2022 17:59
OPNsense dashboard widget for bandwidthd
<?php
/*
* Copyright (C) 2014 Deciso B.V.
* Copyright (C) 2009 Scott Ullrich <[email protected]>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
@kice
kice / fmtlog.h
Last active October 27, 2022 07:31
<fmt> logging library
#pragma once
#ifdef _DEBUG
#define FMTLOG_ENABLE
#endif
#include <string>
#include <functional>
#define FMT_HEADER_ONLY
!"#$%&'()*+,-./0
123456789:;<=>?@
ABCDEFGHIJKLMNOP
QRSTUVWXYZ[\]^_`
abcdefghijklmnop
qrstuvwxyz{|}~©®
°´·ºáéòúōǝɔɞɥʘʚΟ
ΨίειλμπωАВДЕЗЛМН
ОПРСТХЧабвгдежзи
йклмнопрстуфхцчш
{
'"': '"',
'#': '#',
'%': '%',
'&': '&',
'*': '*',
':': ':',
'<': '<',
'>': '>',
'?': '?',
@kice
kice / mcexport.py
Created April 30, 2020 22:53
Convert MineCraft JSON model to Source engine model
import collections
import io
import json
import logging
import logging.handlers
import math
import os
import shutil
import struct
import subprocess
using System;
using System.Runtime.InteropServices;
namespace CSProgressBar
{
public class ProgressBar
{
private readonly int maxLength;
private int lastLen;
// SMAGL is 0 or 2
// PixelType is uint8_t
static void warp_c(const uint8_t *srcp8, const uint8_t *edgep8, uint8_t *dstp8, int src_stride, int edge_stride, int dst_stride, int width, int height, int depth, int bits_per_sample)
{
const uint8_t *srcp = (const uint8_t *)srcp8;
const uint8_t *edgep = (const uint8_t *)edgep8;
uint8_t *dstp = (uint8_t *)dstp8;
src_stride /= sizeof(uint8_t);
edge_stride /= sizeof(uint8_t);
import mxnet as mx
import onnx
import numpy as np
import mxnet.contrib.onnx as onnx_mxnet
model_name = 'somemodel'
model_file = model_name + '.onnx'
onnx_model = onnx.load(model_file)
import os
import re
import json
import subprocess
import argparse
class Args(object):
def __init__(self, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
import os
import argparse
import json
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--format', default='', type=str)
parser.add_argument('-a', '--all', default=False, action='store_true')
args = parser.parse_args()
is_bsp_file = lambda fn: any(fn.endswith(ext) for ext in ['.bsp'])