Skip to content

Instantly share code, notes, and snippets.

@nlgranger
nlgranger / PKGBUILD
Created October 17, 2024 21:48
PKGBUILD skeleton genetator for projects with git submodules
# example of generate output using https://github.com/tianocore/edk2
sources=(
"berkeley-softfloat-3::git+file:///home/ngranger/Downloads/edk2/src/berkeley-softfloat-3"
"brotli::git+file:///home/ngranger/Downloads/edk2/src/brotli"
"cmocka::git+file:///home/ngranger/Downloads/edk2/src/cmocka"
"cryptography::git+file:///home/ngranger/Downloads/edk2/src/cryptography"
"edk2-cmocka::git+file:///home/ngranger/Downloads/edk2/src/edk2-cmocka"
"engine::git+file:///home/ngranger/Downloads/edk2/src/engine"
"googletest::git+file:///home/ngranger/Downloads/edk2/src/googletest"
@nlgranger
nlgranger / system-info.txt
Created February 26, 2024 19:22
system-info.txt
Computer Information:
Manufacturer: Gigabyte Technology Co., Ltd.
Model: B450M GAMING
Form Factor: Desktop
No Touch Input Detected
Processor Information:
CPU Vendor: AuthenticAMD
CPU Brand: AMD Ryzen 5 3600 6-Core Processor
CPU Family: 0x17
CPU Model: 0x71
@nlgranger
nlgranger / sleep.cpp
Last active September 29, 2023 12:55
A7670E sleep
/**
* @file sleep.ino
* @author Lewis He ([email protected])
* @license MIT
* @copyright Copyright (c) 2023 Shenzhen Xin Yuan Electronic Technology Co.,
* Ltd
* @date 2023-05-24
*
*/
#define TINY_GSM_MODEM_SIM7600
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nlgranger
nlgranger / dataloader.py
Last active February 2, 2020 00:52
Pytorch's Dataloader reimplemented using SeqTools
"""A reimplementeation of PyTorch's DataLoader to showcase seqtools.
:author: Nicolas Granger
:license: 0BSD (~public domain)
"""
import numbers
import random
from functools import singledispatch
from multiprocessing import sharedctypes
@nlgranger
nlgranger / PKGBUILD
Created March 3, 2019 19:43
PKGBUILD for libnvidia-container
# Maintainer: Nicolas Granger <[email protected]>
pkgname=libnvidia-container
pkgver=1.0.0
pkgrel=1
pkgdesc="NVIDIA container runtime library"
arch=('x86_64')
url="https://nvidia.github.io/libnvidia-container/"
license=('BSD')
depends=()
makedepends=('bmake' 'rpcsvc-proto')
@nlgranger
nlgranger / decode.c
Created January 12, 2019 19:59
ffmpeg demo using modern decoding API
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <libavutil/avutil.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
char err_str[1024];
@nlgranger
nlgranger / sort_pdist.py
Created July 27, 2018 15:49
sort pairwise distance matrix
# like https://gmarti.gitlab.io/ml/2017/09/07/how-to-sort-distance-matrix.html
# but using just 4 lines of code thanks to 'optimal_ordering' argument
# added to scipy.cluster.hierarchy.linkage
import matplotlib.pyplot as plt
import numpy as np
from scipy.cluster.hierarchy import linkage
# distance matrix
m = np.zeros((500, 500))
# Implementation of Matching Networks for Tensorflow.
# O. Vinyals, C. Blundell, T. Lillicrap, D. Wierstra, and others,
# “Matching networks for one shot learning,” in Advances in Neural Information
# Processing Systems, 2016, pp. 3630–3638.
# Copyright 2018 Nicolas Granger <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@nlgranger
nlgranger / demo.py
Created February 27, 2018 11:12
tensorflow training script that does not generate graph.pbtxt
import numpy as np
import tensorflow as tf
from procnet.utils import sensible_dir
from experiments.SpatialTransformerNetwork.model import spatial_transformer
from experiments.SpatialTransformerNetwork import dataset
def build_model_layers(inputs, nclasses, is_training):
initializer = tf.contrib.layers.xavier_initializer()