Skip to content

Instantly share code, notes, and snippets.

View pbosetti's full-sized avatar
:octocat:

Paolo Bosetti pbosetti

:octocat:
View GitHub Profile
@pbosetti
pbosetti / cloud-init.yml
Last active May 14, 2024 11:16
cloud-init for C-CNC-ready virtual machines
#cloud-config
users:
- default
- name: ccnc
gecos: C-CNC User
groups: sudo
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
passwd: $6$rounds=4096$zHeUceWF8g9fEz1H$6bMoNJcKX4bt9rcYIHKEG2TjoLCHRMDwYsz98NEI3N7UgexTNv2XhMvvc4qrnky.ScBpSe68WDoP0FXXHJRTL.
@pbosetti
pbosetti / 0_utils.R
Last active March 18, 2024 10:15
Statistics example data
# This file provides base utilities
# Check for requirements
if (!exists("read_file")) {
if (!require(readr)) {
stop("Please install readr (or tidyverse) package")
}
}
#' Get the url for sample files from gist repo
@pbosetti
pbosetti / mkstub.rb
Last active May 2, 2023 11:50
Script for generating stub dynamic libraries for cross compilation
#!/usr/bin/env ruby
# This script can create stub C libraries that are useful in cross-compilation
# tasks.
# Usage:
# ./mkstub.rb <path to original library file> [linux|macos]
# This will generate a stub file, a compiled shared object for the local system,
# and a shell script named compile_<libname>_stub.sh. The latter shall be copied
# to the target system (specified by the optional second argument), which
# doesn't have the library of matter, and executed, resulting in a shared object
# that represents a stub of the original library. A stub library has all the
@pbosetti
pbosetti / kernelRT.md
Last active May 28, 2024 11:36
Build RT linux kernel
KVER=6.5.2
RTVER=8
mkdir kernel && cd kernel
wget https://mirrors.edge.kernel.org/pub/linux/kernel/v6.x/linux-${KVER}.tar.gz
wget https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/6.5/patch-${KVER}-rt${RTVER}.patch.gz
tar xzf linux-${KVER}.tar.gz
cd linux-${KVER}
gzip -cd ../patch-${KVER}-rt${RTVER}.patch.gz|patch -p1

Keybase proof

I hereby claim:

  • I am pbosetti on github.
  • I am p4010 (https://keybase.io/p4010) on keybase.
  • I have a public key ASDEuZaOoLlLVl3Y5fWA8zMcc4FloDEsY2Hais05Xa8BOAo

To claim this, I am signing this object:

@pbosetti
pbosetti / tictoc.h
Created April 15, 2022 12:35
TicToc timing utility for C
/*
_____ _ _____
|_ _(_) __|_ _|__ ___
| | | |/ __|| |/ _ \ / __|
| | | | (__ | | (_) | (__
|_| |_|\___||_|\___/ \___|
* timing utility
//
#include <time.h>

How to build deb packages for PREEMPT_RT kernel patch

Install Dependencies

Install compilers required for building the kernel:

$ sudo apt install build-essential git libssl-dev libelf-dev
$ Download and patch
@pbosetti
pbosetti / vsc_setup.sh
Last active December 2, 2020 16:20
VisualStudio Code setup script
#!/usr/bin/env sh
# Call this script remotely:
# $ sh <(wget -qO- "https://git.io/JJPaQ")
OS=$(uname)
CODE="VisualStudio Code"
echo "Setting up Visual Studio Code on $OS"
if [ "$OS" = "Darwin" ]; then
@pbosetti
pbosetti / recurstats.pdf
Last active April 6, 2023 01:13
Recursion formulas for sample mean and sample variance
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pbosetti
pbosetti / virtual_ide.md
Last active November 8, 2016 11:43
Setup instruction for Manufacturing Automation class

Setup instruction for Manufacturing Automation class

Prerequisites

You need a laptop (Mac or PC) with at least 20 Gb of available disk space. The laptop needs a relatively recent CPU (Intel Core i3 or better).

Virtualization platform

In order to make the life easier for all of us avoiding the issues originating from the use of different platforms and operating systems, we will work on the same OS