Skip to content

Instantly share code, notes, and snippets.

@afonso360
afonso360 / riscv64inst.sh
Created April 11, 2023 14:08
Shows how instructions are encoded. Example: `echo "vadd.vv v8, v8, v8" | ./riscv64inst.sh`
#!/bin/sh
tmp=`mktemp /tmp/XXXXXXXX.o`
# riscv64-linux-gnu-as /dev/stdin -o $tmp
# riscv64-linux-gnu-objdump -d $tmp
cat - > $tmp
clang -x assembler --target=riscv64 -march=rv64gcv -c $tmp -o $tmp
llvm-objdump --triple=riscv64 --mattr=+v,+zba,+zbb,+zbc,+zbs,+zbkb -d $tmp
rm -f $tmp
<html>
<head>
<title>Cargo Build Timings — bevy 0.9.0</title>
<meta charset="utf-8">
<style type="text/css">
html {
font-family: sans-serif;
}
This file has been truncated, but you can view the full file.
libbevy_ecs_llvm.rlib(lib.rmeta): file format COFF-x86-64
Sections:
Idx Name Size VMA Type
0 .rmeta 0085bfef 0000000000000000
libbevy_ecs_llvm.rlib(bevy_ecs-ba385c456f9a7f8d.bevy_ecs.e9830b4a-cgu.0.rcgu.o): file format COFF-x86-64
This file has been truncated, but you can view the full file.
libbevy_ecs_cgclif.rlib(lib.rmeta): file format COFF-x86-64
Sections:
Idx Name Size VMA Type
0 .rmeta 008300cf 0000000000000000
libbevy_ecs_cgclif.rlib(bevy_ecs-8e53e408788774c0.bevy_ecs.04f12576-cgu.0.rcgu.o): file format COFF-x86-64
@afonso360
afonso360 / stack.rs
Last active September 10, 2022 18:43
#!/usr/bin/env bash
#![deny(unsafe_code)] /*This line is ignored by bash
# This block is ignored by rustc
set -e
echo "[BUILD] stack.rs" 1>&2
rustc $0 -o ${0/.rs/.bin} -Cdebuginfo=1
exec ${0/.rs/.bin} $@
*/
use std::collections::btree_map::Entry;
@afonso360
afonso360 / gist:80e340fd3deb4972090239079e54cdd4
Created September 9, 2019 09:26
Search all repositories for commits on a certain date
find . -mindepth 1 -type d -name ".git" -print0 | xargs -0 -I{} bash -c 'cd "{}/../" && echo "$(pwd)" && git log --after="2019-09-05" --before="2019-09-06"'
### Keybase proof
I hereby claim:
* I am afonso360 on github.
* I am afonsobordado (https://keybase.io/afonsobordado) on keybase.
* I have a public key whose fingerprint is AE10 D69E 1EE2 D5E3 A349 EB13 E8BE 8563 0072 B7B8
To claim this, I am signing this object:
@afonso360
afonso360 / mongoose_example.c
Created January 6, 2015 19:21
Multi-Threaded Mongoose server example
#include <stdio.h>
#include <string.h>
#include "mongoose/mongoose.h"
static int ev_handler(struct mg_connection *conn, enum mg_event ev){
switch(ev){
case MG_AUTH:
return MG_TRUE;
case MG_REQUEST:
@afonso360
afonso360 / gist:37badf61c0f8d370022e
Created December 30, 2014 14:41
OpenGL Example
import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
public class TimerExample {
/** position of quad */
@afonso360
afonso360 / gist:be2530ddbe56f42eab30
Created August 6, 2014 00:50
[8/04/2014] Challenge #174 [Easy] Thue-Morse Sequences /r/dailyprogrammer
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
int main(int argc, char *argv[]){
int sequence_count;
if(argc>1){
sequence_count = atoi(argv[1]);
}else{
printf("%s SIZE",argv[0]);