Skip to content

Instantly share code, notes, and snippets.

View zenofile's full-sized avatar

zenofile zenofile

View GitHub Profile
@zenofile
zenofile / make_current_arm64_rpi_kernel_debs.sh
Last active February 3, 2021 14:40 — forked from satmandu/make_current_arm64_rpi_kernel_debs.sh
Make arm64 deb packages for the offical Raspberry Pi Foundation arm64 kernels + NOW INSTALLS headers package too.
#!/bin/bash -x
# make_arm64_rpi_kernel_debs.sh
# Builds arm64 debian packages from the CURRENT rpi firmware repository kernel which is installed by:
# sudo rpi-update
# This runs on an arm64 host with arm64 compilation tools...
# or with some sort of cross-compilation setup.
# Debs are put in $workdir/build
#
# This will NOT work in Raspbian unless you have an arm64 compilation
# environment setup. Appears to work on
@zenofile
zenofile / github2Gitea.js
Created October 9, 2020 16:59 — forked from lrecknagel/github2Gitea.js
a small nodejs module to migrate a list of github repos (FROM A ORGANIZATION) to gitea
const fetch = require('node-fetch'),
FormData = require('form-data');
// your gitea domain without trailing slash
const GITEA_DOMAIN = 'https://subdomain.domain.xyz';
// you can find this variables when you visit your gitea installation
// open dev-tools and look in the Cookies section
const i_like_gitea = 'YOUR_I_LIKE_GITEA_STRING';
const gitea_awesome = 'YOUR_GITEA_AWESOME_STRING';

Foreward

This document was originally written several years ago. At the time I was working as an execution core verification engineer at Arm. The following points are coloured heavily by working in and around the execution cores of various processors. Apply a pinch of salt; points contain varying degrees of opinion.

It is still my opinion that RISC-V could be much better designed; though I will also say that if I was building a 32 or 64-bit CPU today I'd likely implement the architecture to benefit from the existing tooling.

Mostly based upon the RISC-V ISA spec v2.0. Some updates have been made for v2.2

Original Foreword: Some Opinion

The RISC-V ISA has pursued minimalism to a fault. There is a large emphasis on minimizing instruction count, normalizing encoding, etc. This pursuit of minimalism has resulted in false orthogonalities (such as reusing the same instruction for branches, calls and returns) and a requirement for superfluous instructions which impacts code density both in terms of size and

@zenofile
zenofile / script-template.sh
Created December 16, 2020 18:37 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@zenofile
zenofile / systemd_service_hardening.md
Created May 14, 2021 21:32 — forked from ageis/systemd_service_hardening.md
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
AWSTemplateFormatVersion: '2010-09-09'
Description: Extreme Performance Tuning Benchmark Environment
Parameters:
AmiId:
Type: AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
Default: '/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2'
@zenofile
zenofile / txq.bt
Created May 22, 2021 02:33 — forked from talawahtech/txq.bt
txq.bt - monitor the length of an AWS ENA device's transmit queue
#include "txq.h"
kprobe:ena_com_prepare_tx
{
// grab/cast the transmit queue param
$io_sq = (struct ena_com_io_sq *) arg0;
// logic copied from from ena_com_free_q_entries
$queuelen = (uint16) $io_sq->tail - (uint16) $io_sq->next_to_comp;
@zenofile
zenofile / netmonitor.sh
Created May 22, 2021 02:35 — forked from talawahtech/netmonitor.sh
netmonitor.sh - A simple bash script to calculate throughput and pps
#!/bin/bash
# Bash script to calculate throughput and packets/sec
# Based on code from https://discuss.aerospike.com/t/benchmarking-throughput-and-packet-count-with-iperf3/2791
if [ -z "$1" ]; then
echo
echo usage: $0 [network-interface]
echo
echo defaulting to eth0
@zenofile
zenofile / README.md
Created May 22, 2021 03:03 — forked from pamolloy/README.md
Mesh network using VXLAN over Wireguard
/*
* ctx_time Copyright (C) 2018 Matteo Croce <[email protected]>
* a tool measure the context switch time in clock cycles
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>