Skip to content

Instantly share code, notes, and snippets.

View ChristopherRabotin's full-sized avatar
🚀

Chris ChristopherRabotin

🚀
View GitHub Profile
@ChristopherRabotin
ChristopherRabotin / gist:a649e0d2c818610c0feb1235e09ff88f
Created January 15, 2021 21:07
Kernel panic -- 5.10.4-1-default #1 openSUSE Tumbleweed
Jan 14 22:51:41 localhost kernel: BUG: unable to handle page fault for address: ffff980ef0af4370
Jan 14 22:51:41 localhost kernel: #PF: supervisor write access in kernel mode
Jan 14 22:51:41 localhost kernel: #PF: error_code(0x0002) - not-present page
Jan 14 22:51:41 localhost kernel: PGD 316201067 P4D 316201067 PUD 0
Jan 14 22:51:41 localhost kernel: Oops: 0002 [#1] SMP PTI
Jan 14 22:51:41 localhost kernel: CPU: 3 PID: 24150 Comm: ld Tainted: P OE 5.10.4-1-default #1 openSUSE Tumbleweed
Jan 14 22:51:41 localhost kernel: Hardware name: Alienware Alienware Aurora R7/0VDT73, BIOS 1.0.20 10/31/2019
Jan 14 22:51:41 localhost kernel: RIP: 0010:get_page_from_freelist+0x10c/0x1320
Jan 14 22:51:41 localhost kernel: Code: 00 00 00 e9 1b 01 00 00 48 be 00 01 00 00 00 00 ad de 48 8b 44 24 08 48 8b 40 10 48 8b 08 48 8b 50 08 48 8d 78 f8 48 89 51 08 <48> 89 0a 48 89 30 48 83 c6 22 48 89 70 08 48 8b 74 24 40 83 2e 01
Jan 14 22:51:41 localhost kernel: RSP: 0018:ffffb9da10d43ae0 EFLAGS: 00010093
Input:
┌ ┐
│ -2436.45 │
│ -2436.45 │
│ 6891.037 │
│ 5.088611 │
│ -5.088611 │
│ 0 │
└ ┘
Solution:
@ChristopherRabotin
ChristopherRabotin / Makefile
Created February 21, 2019 23:57
dangerous lack of lifetimes
coffee:
rustc lib.rs --crate-type=cdylib -C opt-level=3 -C target-cpu=native
gcc main.c -o main.o -L. -llib -O3
LD_LIBRARY_PATH=. ./main.o
@ChristopherRabotin
ChristopherRabotin / cosm.rs
Created February 14, 2019 06:12
Can I have a storage of a dynamically parametrized struct? Eg. `HashMap<Identifier, Box<Frame<dyn Body>>>`
// Defines Cosm, from the Greek word for "world" or "universe".
extern crate petgraph;
use crate::frames::*;
use nalgebra::UnitQuaternion;
use petgraph::Graph;
use std::collections::HashMap;
pub trait Cosm {}
@ChristopherRabotin
ChristopherRabotin / rslt.c
Created February 5, 2019 06:32
A result like type in C using a struct and a union
/*
Output:
$ gcc rslt.c -o rslt && ./rslt
[OK] kind=0 data=15.159000 errno=8389
[!!] kind=1 data=0.000000 errno=-3
size = 16
*/
#include <stdio.h>

Keybase proof 

I hereby claim:    * I am christopherrabotin on github.   * I am topherbr (https://keybase.io/topherbr) on keybase.   * I have a public key ASCu5IXdUynw9xWspVTKB0joueNYa9VpMXtt4VeskSlLxAo  To claim this, I am signing this object: 

{   "body": {     "key": {       "eldest_kid": "0120aee485dd5329f0f715aca554ca0748e8b9e3586bd569317b6de157ac91294bc40a",       "host": "keybase.io",       "kid": "0120aee485dd5329f0f715aca554ca0748e8b9e3586bd569317b6de157ac91294bc40a",       "uid": "247f193394b629b32f29a66b4fd33219",       "username": "topherbr"     },     "merkle_root": {       "ctime": 1521738576,       "hash": "2a513088b83cd9de10072d1497ff9b0b364725fae88d7a630b6f3bbf8bbc1709a90d714a3d7c0cb45a89fefbd36c5da0fcdd64f49eb3cb71d4ad7c43892689f0",       "hash_meta": "f934da3ea3421e91bafb22a698635c6d2d8fce06c5ef3c16f8ab2096f2dc49e8",       "seqno": 2273431     },     "service": {       "name": "github",       "username": "christopherrabotin"     },     "type": "web_service_binding",     "version
@ChristopherRabotin
ChristopherRabotin / Cargo.toml
Created February 8, 2018 18:07
Rust Python FFI with Python function defintion called by Rust (broken)
[package]
name = "nyxbin"
version = "0.1.0"
authors = ["XX <YY@ZZ.com>"]
[dependencies]
nalgebra = "0.14.0"
[lib]
name = "nyxbin"
@ChristopherRabotin
ChristopherRabotin / halofunc.m
Created June 14, 2017 07:01
Single shooter Matlab code for finding Halo orbits (*not* validated!)
function state = halofunc(X)
% Parse state vector into variables
x = X(1);
y = X(2);
z = X(3);
vx = X(4);
vy = X(5);
vz = X(6);
Phi = reshape(X(7:end), 6,6);
@ChristopherRabotin
ChristopherRabotin / main.c
Created May 22, 2017 02:34
Zephyr cpp demo
/*
* Copyright (c) 2012-2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <misc/printk.h>
#include "test.hpp"
\documentclass[11pt, oneside]{article} % use "amsart" instead of "article" for AMSLaTeX format
\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper} % ... or a4paper or a5paper or ...
%\usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx} % Use pdf, png, jpg, or eps§ with pdflatex; use eps in DVI mode
% TeX will automatically convert eps --> pdf in pdflatex
\usepackage{amssymb}