Skip to content

Instantly share code, notes, and snippets.

View sandeshbhusal's full-sized avatar
💭
Learning

Sandesh Bhusal sandeshbhusal

💭
Learning
View GitHub Profile
@sandeshbhusal
sandeshbhusal / actors.rs
Created September 14, 2024 04:56
Simple actor framework definition in Rust
use std::{
future::Future,
io::{Error, Read, Write},
net::UdpSocket,
};
use anyhow::Result;
use async_channel::{Receiver, Sender};
use serde::{Deserialize, Serialize};
use tokio::{select, task::JoinHandle};
@sandeshbhusal
sandeshbhusal / works.md
Last active January 12, 2024 03:49
NeSA Meeting agenda
  • Priority List

    • Create events for Potluck / Nepali night ^^Everest+Sandesh (13th/14th Jan)^^
    • Hall booking for Nepali Night ^^Everest+Sandesh (After meeting with Sarah: ?Next weekend)^^
    • Apply for Funding for Nepali Night ^^Peshal+Srijana^^ Jan end
      • Financial Breakdown for funding application ^^Karuna+Srijana^^ Jan 20/21
    • Reach out to Alumni for Donations ^^Usha+karuna+Aman^^ Feb Mid samma
    • Reach out to Community for performances and volunteering (Interest forms) ^^Upama+Karuna+Usha^^ March start samma
    • Student Involvement desk
  • Up for self nomination
@sandeshbhusal
sandeshbhusal / today.md
Created January 11, 2024 07:10
Today was a good day
  • Today was a good day - paper review

    • 3.2: Factors that impact workdays
      • Vast research body available.
      • human aspects are left out generally - liike job satisfaction (which is general fulfilment - influenced by good and bad workdays)
      • affective states impact the assessment of a good and bad workday
        • Positive affective state => Positive effect on problem solving skills and productivity
      • Previous work -> +ve emotion = good workday. Hope is a mediator. Positive emotions at work increase openness to new experiences, dedication, work engagement.
      • Sheldon et al have further shown that on good days, students feel they have higher levels of autonomy and competence which reulsts in better outcomes.

  • What does "students" mean in this case?
@sandeshbhusal
sandeshbhusal / gridworld_final.py
Created December 11, 2023 20:13
Gridworld final exam
grid = [[-1] * 5 for i in range(0, 4)]
grid[0][2] = -100000
grid[0][4] = 1000
grid[1][2] = -100000
grid[3][3] = -100
final_states = [
(0, 2),
(0, 4),
@sandeshbhusal
sandeshbhusal / gridworld.py
Created October 23, 2023 03:26
A simple implementation of gridworld. There is a certain modification - stepping into state '9' gets a +3 reward, and every action from state '9' goes to state '3'. This can be changed in the transition map as required.
from typing import *
class State(object):
'''
Terminal states do not change their values
'''
def __init__(self, id: int, value: int, transitions: List[int], is_terminal: bool) -> None:
self.id = id
self.value = value
self.transitions = transitions
@sandeshbhusal
sandeshbhusal / ADC_2020_2_1.rs
Created August 15, 2021 14:08
Advent of Code 2020 Problem 2 Solution #1 RUST Solution
use scan_fmt::{scan_fmt};
use std::{fs::File, io:: {BufRead, BufReader}};
fn main(){
let file_path : String = String::from("src/input.txt");
let bufreader = BufReader::new(File::open(file_path).expect("Could not open file"));
let correct_passwords = bufreader.lines().map(|_line| {
match scan_fmt!(&_line.unwrap(), "{}-{} {}: {}" , i32, i32, char, String) {
Ok((a, b, c, d)) => {
if a <= d.chars().map(|k| { if c == k {1} else {0} } ).sum::<i32>() && b>= d.chars().map(|k| { if c == k {1} else {0} } ).sum::<i32>() {
1
// Author : Sandesh Bhusal
// Date Feb 23, 2021
// You may copy, download and modify the source code according to your requirements :)
// Happy Spoofing!
// Original Code Lives at https://gist.github.com/sandeshbhusal/c8fa09546ffc076e5103456dd4e3742d
package main
import (
"flag"
// Author : Sandesh Bhusal
// Date Feb 23, 2021
// You may copy, download and modify the source code according to your requirements :)
// Happy Spoofing!
// Original Code Lives at https://gist.github.com/sandeshbhusal/c8fa09546ffc076e5103456dd4e3742d
package main
import (
"flag"
import numpy as np
import pandas as pd
from scipy.ndimage.interpolation import shift
import cv2
from matplotlib import pyplot as plt
input_photo_path = "/kaggle/input/84474892_2612930752149692_1911641796866211840_o.jpg"
@sandeshbhusal
sandeshbhusal / Reverse BWT.cpp
Created February 18, 2019 07:38
Reverse Burrows Wheeler Transformation
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
bool sortFunction(std::string s1, std::string s2){
if(s1[0] < s2[0]) return true;
if(s2[0] < s1[0]) return false;
int i = 0;
int min = s1.size() < s2.size() ? s1.size() : s2.size();