Skip to content

Instantly share code, notes, and snippets.

@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 (lewishe@outlook.com)
* @license MIT
* @copyright Copyright (c) 2023 Shenzhen Xin Yuan Electronic Technology Co.,
* Ltd
* @date 2023-05-24
*
*/
#define TINY_GSM_MODEM_SIM7600
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 <nicolas.granger.m@gmail.com>
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 <nicolas.granger@telecom-sudparis.eu>
#
# 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()
@nlgranger
nlgranger / generic_linkcode_resolve_for_sphinx.py
Last active January 18, 2024 13:26
A generic implementation of linkcode_resolve for the 'sphinx.ext.viewcode' extension of sphinx
# the sphinx extension 'sphinx.ext.viewcode' links documentation to an online
# code repository but requires to bind the code to the url through a user
# specific `linkcode_resolve` function. This implementation should be fairly
# generic and easily adaptable.
#
# License: Public Domain, CC0 1.0 Universal (CC0 1.0)
import sys
import os
import subprocess