Skip to content

Instantly share code, notes, and snippets.

View giuseppe998e's full-sized avatar

Giuseppe Eletto giuseppe998e

View GitHub Profile
@giuseppe998e
giuseppe998e / calc_voto_triennale.py
Created June 9, 2021 18:28
Script per calcolare il voto di partenza per la laurea triennale presso il Dip.Inf. @ UniTo
#!/usr/bin/env python3
# Calcolatore della media di laurea triennale
# presso l'università degli studi di Torino
# dipartimento di informatica
#
# Questo script segue la direttiva qui di seguito:
# http://laurea.educ.di.unito.it/packages/offerta_formativa/single_pages/accreditamento/consultazione/ScaricaDocumento.php?documento=846
#
# Author: Giuseppe Eletto
# License: MIT
@giuseppe998e
giuseppe998e / xentrace_event_id.c
Last active March 26, 2021 17:08
Example of bit subdivision of an id of a XenTrace event
#include <stdio.h>
int main() {
// TRC_TRACE_CPU_CHANGE
unsigned cpu_change = 0x0001f003;
struct {
unsigned minor:12,
sub:4,
main:12,
@giuseppe998e
giuseppe998e / bitwise_32to2x16_and_viceversa.c
Last active April 30, 2021 10:10
Example of "32bit -> 2 * 16bit" and viceversa
#include <stdio.h>
/* 32bit -> 2 * 16bit */
void from32to2x16() {
int z = 0x77771010,
x = z >> 16,
y = z & 0x0000ffff;
printf(">> 32bit -> 2 * 16bit <<\n");
printf("Result 1: 0x%08x\n", x);
@giuseppe998e
giuseppe998e / aay.js
Last active September 15, 2021 07:53
Academic Year generator in JS (Start from October)
const academicYear = (firstMonth = 8) => {
const date = new Date(),
year = date.getFullYear(),
start = date.getMonth() > firstMonth
return `${year - !start}/${year + start}`
}
/* const academicYear=(firstMonth=8)=>{const d=new Date(),y=d.getFullYear(),s=d.getMonth()>firstMonth;return `${y-!s}/${y+s}`} */
console.log(`Academic Year: ${academicYear()}`);
@giuseppe998e
giuseppe998e / fliter.js
Last active March 23, 2021 21:33
5 Lines Iterator JS
// Five Lines Iterator [ fliter (╥﹏╥) ]
const fliter = (a, p = 0) => ({
hasNext: () => p < a.length,
next: () => a[p++],
remove: () => a.splice(--p, 1)
})
/* Minified
* const fliter=(a,p=0)=>({hasNext:()=>p<a.length,next:()=>a[p++],remove:()=>a.splice(--p,1)})
*/
@giuseppe998e
giuseppe998e / Dockerfile
Last active September 26, 2021 23:16
Docker Alpine MurMur (Mumble Server) with persistence | Works on RPI (3B tested)
FROM alpine
LABEL maintainer="Giuseppe Eletto <peppe.eletto@gmail.com>"
# Setup environment
RUN adduser -DHs /sbin/nologin murmur \
&& apk update \
&& apk upgrade \
&& apk add murmur \
&& rm -rf /var/cache/apk/*

Keybase proof

I hereby claim:

  • I am giuseppe998e on github.
  • I am peppe (https://keybase.io/peppe) on keybase.
  • I have a public key ASBBNqjBQjelWJ8BP99gS3SnE6uyypUsh6QtLciG1XPU5Ao

To claim this, I am signing this object: