Skip to content

Instantly share code, notes, and snippets.

View NishanthSpShetty's full-sized avatar
🎯
Focusing

Nishanth Shetty NishanthSpShetty

🎯
Focusing
View GitHub Profile
@NishanthSpShetty
NishanthSpShetty / kubectl-apply-light.go
Created February 11, 2022 07:21
Apply kubernetes manifest yaml file using k8s golang client
package kubectl
import (
"context"
"errors"
"fmt"
"io/ioutil"
"net/http"
"strings"
systemd-udevd[321280]: Worker [321284] terminated by signal 11 (SEGV)
Aug 26 22:23:27 Lenovo-IdeaPad-S145-15IWL systemd-udevd[321280]: hidraw2: Worker [321284] failed
Aug 26 22:23:27 Lenovo-IdeaPad-S145-15IWL kernel: [18744.968972] general protection fault, probably for non-canonical address 0xbfffe84b8747e200: 0000 [#13] SMP NOPTI
Aug 26 22:23:27 Lenovo-IdeaPad-S145-15IWL kernel: [18744.968983] CPU: 2 PID: 321286 Comm: systemd-udevd Tainted: G D OE 5.11.0-27-generic #29~20.04.1-Ubuntu
Aug 26 22:23:27 Lenovo-IdeaPad-S145-15IWL kernel: [18744.968986] Hardware name: LENOVO 81MV/LNVNB161216, BIOS ASCN36WW 05/31/2019
Aug 26 22:23:27 Lenovo-IdeaPad-S145-15IWL kernel: [18744.968988] RIP: 0010:___slab_alloc+0x65/0x620
Aug 26 22:23:27 Lenovo-IdeaPad-S145-15IWL kernel: [18744.968997] Code: 89 84 24 88 00 00 00 31 c0 4d 85 ff 0f 84 3c 01 00 00 83 fb ff 0f 84 8d 00 00 00 49 8b 07 48 c1 e8 36 89 44 24 3c 39 c3 75 6d <49> 8b 57 08 48 8d 42 ff 83 e2 01 49 0f 44 c7 48 8b 00 a8 20 0f 85
Aug 26 22:23:27 Lenovo-Ide
@NishanthSpShetty
NishanthSpShetty / main.rs
Created January 23, 2020 07:47
Stack-VM entrypoint
extern crate byteorder;
mod lib;
use byteorder::{ByteOrder, LittleEndian};
use lib::vm;
use std::io::prelude::*;
use std::fs::File;
@NishanthSpShetty
NishanthSpShetty / primitive.rs
Last active January 23, 2020 08:04
Stack-VM core arithemtic unit.
fn do_primitive(&mut self) {
match self.current_data() & 0xCfffff {
0 => {
debug!("[ HALT ] : Stopping VM ");
self.set_running(false);
return;
}
1 => {
let top_1 = self.stack.pop();
let top_2 = self.stack.pop();
@NishanthSpShetty
NishanthSpShetty / stack.rs
Created January 22, 2020 10:57
Implement runtime stack for Stack-VM
pub struct VMStack {
internal_stack: Vec<i32>,
capacity: usize,
top: usize, //also size
}
impl VMStack {
pub fn new(stack_size: usize) -> VMStack {
VMStack { capacity: stack_size, top: 0, internal_stack: Vec::with_capacity(stack_size) }
}