Skip to content

Instantly share code, notes, and snippets.

View harenome's full-sized avatar
🔒
🔒

Harenome 安仁 Ranaivoarivony-Razanajato harenome

🔒
🔒
View GitHub Profile
@harenome
harenome / soc.py
Last active April 30, 2026 16:20
soc.py
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
"""Query SoC platform info."""
# Copyright 2026 Harenome Ranaivoarivony-Razanajato
#
# 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
@harenome
harenome / dtypes.py
Created April 30, 2026 13:35
Quick-and-dirty `torch.dtype` validation
#!/usr/bin/env python3
# SPDX-License-Identifier: BSD-3-Clause
"""Minimal utilities for torch.dtype validation.
Nothing fancy nor complicated but the kind of thing you don't do often enough to
remember right off the bat when you do need it.
Most of the `torch` API accepts both `str` and `torch.dtype` as `dtype` args.
It is usually better and easier to directly forward `dtype` to whatever `torch`
.PHONY: all clean
CFLAGS = -std=gnu11 -O3 -march=native -Wall -Wextra
test_vect3d: test_vect3d.o vect.o
$(CC) $^ -o $@
clean:
rm -rf *.o
@harenome
harenome / azertyuiop.c
Last active August 29, 2015 14:01
Don't copy-paste this.
//Compile: gcc -std=c99
#include <stdio.h>
#define m(z) z(
#define _(__) ) __
#define b(h,y,u) u ## y ## h
#define f m(for)
#define p ! 'c'-'c', m(b(tf,in,pr))
typedef int t;
t main()
{

Compiler:

$ g++ -pedantic -std=c++98 -Wall -g *pp
@harenome
harenome / README.md
Last active August 29, 2015 13:59
Devoir pour l'UE Intelligence Artificielle, L3S6 Informatique, Université de Strasbourg.

Ne pas oublier de compiler en C++11.

$ g++ -std=c++11 -pedantic -Wall -g *pp
@harenome
harenome / java_makefile
Last active December 25, 2015 21:39
Makefile for small Java projects.
CC = javac
JPATH = src
BPATH = bytecode
DPATH = doc
vpath %.java $(JPATH)/
vpath %.class $(BPATH)/
all : | bytecodedir
@harenome
harenome / basic_c_makefile
Last active December 25, 2015 21:39
Basic makefile to automagically compile every *.c file in the current directory.
CC = gcc
CFLAGS = -Wall -std=c99 -pedantic
SOURCES=$(wildcard *.c)
EXE=$(patsubst %.c,%,$(SOURCES))
all : $(EXE)
.c :
$(CC) $(CFLAGS) -o $@ $<
@harenome
harenome / gist:5446950
Created April 23, 2013 20:06
TP4 – Tri
# Section .data {{{
.data
RetChar: .asciiz "\n"
Tableau: .asciiz "Tableau de taille: "
Aladresse: .asciiz "à l'adresse: "
Adresse: .asciiz "Adresse du premier entier du tableau: "
Place: .asciiz "Place de l'entier dans le tableau: "
#}}}