Skip to content

Instantly share code, notes, and snippets.

View AryanGodara's full-sized avatar
🧏
BYE🤫BYE🧏

Aryan Godara AryanGodara

🧏
BYE🤫BYE🧏
View GitHub Profile
import { getAddress } from "@zetachain/protocol-contracts";
import { task } from "hardhat/config";
import { HardhatRuntimeEnvironment } from "hardhat/types";
const main = async (args: any, hre: HardhatRuntimeEnvironment) => {
if (hre.network.name !== "zeta_testnet") {
throw new Error(
'🚨 Please use the "zeta_testnet" network to deploy to ZetaChain.'
);
}
@AryanGodara
AryanGodara / .deps...npm...virtual
Created October 31, 2023 16:56
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.19+commit.7dd6d404.js&optimize=false&runs=200&gist=
/**
* Minified by jsDelivr using Terser v5.19.2.
* Original file: /npm/virtual@0.2.0/dist/index.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
"use strict";var _slice=Array.prototype.slice,_inherits=function(t,e){t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)};require("6to5/polyfill");var _=require("lodash"),should=require("should"),Promise=(global||window).Promise=require("bluebird"),__DEV__="production"!==process.env.NODE_ENV,__PROD__=!__DEV__,__BROWSER__="object"==typeof window,__NODE__=!__BROWSER__;__DEV__&&Promise.longStackTraces();var VirtualMethodCall=function(){var t=TypeError,e=function(t){this.message="Attempting to call virtual method "+t+"."};return _inherits(e,t),e}(),VirtualMethodNotImplemented=function(){var t=TypeError,e=function(t){this.message="Virtual method "+t+" not implemented."};return _inherits(e,t),e}(),__virtualMethod
@AryanGodara
AryanGodara / autofocus.py
Created September 21, 2023 09:56
The code for the autofocus implementation
import serial
import time
import cv2
from time import sleep
import picamera
from picamera import PiCamera
camera=PiCamera()
import numpy as np
#initialize the serial port
ser=serial.Serial('/dev/ttyUSB0',9600,timeout=1)
@AryanGodara
AryanGodara / README.md
Created September 21, 2023 09:55
Autofocus 10x

Autofocus in 10x

This project is the implementation of an algorithm which automates the focusing processes of a microscope

Installations

install cv2 library as we are going to be using this mainly for the computer vision part.

Now there are two ways of installing the cv2 library:

  • install the main modules package:
@AryanGodara
AryanGodara / main.ml
Created September 19, 2023 12:31
main.ml for pub-sub-receiver
let () =
print_endline "Launching UDP Client...";
let () = Logs.set_reporter (Logs.format_reporter ()) in
let () = Logs.set_level (Some Logs.Info) in
let client_socket = Client.create_socket () in
Lwt_main.run Client.(handle_sub client_socket)
@AryanGodara
AryanGodara / client.ml
Created September 19, 2023 12:30
client.ml for pub-sub-receiver
open Lwt.Infix
(* Shared mutable counter *)
let listen_address = Unix.inet_addr_loopback
let port = 9000
let counter = ref 0
let rec handle_request server_socket =
counter := !counter + 1;
@AryanGodara
AryanGodara / main.ml
Created September 19, 2023 12:28
main.ml for pub-sub-publisher
let () =
print_endline "Launching UDP Client...";
let msgList = ["903C28" ; "903C00" ; "903C1e" ; "903C00" ; "90432D" ; "904300" ; "904332"; "904300"; "90452D" ; "904500"; "904532"; "904500"; "904323"; "904300"; "904132"; "904100"; "90412D"; "904100"; "904032"; "904000" ; "904028"; "904000" ; "903E2D"; "903E00"; "903E32" ; "903E00" ; "903C1E"; "903C00"] in
let () = Logs.set_reporter (Logs.format_reporter ()) in
let () = Logs.set_level (Some Logs.Info) in
let client_socket = Client.create_socket () in
Lwt_main.run Client.(handle_request client_socket msgList)
@AryanGodara
AryanGodara / client.ml
Created September 19, 2023 12:28
client.ml file for pub-sub-publisher
open Lwt.Infix
(* Shared mutable counter *)
let listen_address = Unix.inet_addr_loopback
let port = 9000
let handle_message msg =
print_endline ("Received message in handle_message: " ^ msg);
match msg with "quit" -> "quit" | _ -> "Ready for next message"
@AryanGodara
AryanGodara / main.ml
Created September 19, 2023 12:25
main.ml file for pub-sub-server
let main () =
Midi.init ();
List_devices.list_devices () |> ignore;
()
let () =
print_endline "Launching MIDI Server...";
main ();
print_endline "Setting up Logs...";
@AryanGodara
AryanGodara / udpServer.ml
Created September 19, 2023 12:22
Implementation for the udpServer module
open Lwt.Infix
open TopicFilter
let parse_hex_string hex_string =
let length = String.length hex_string in
if length mod 2 <> 0 then failwith "Invalid hex string length";
let bytes = Bytes.create (length / 2) in
let i = ref 0 in
while !i < length do
let byte = int_of_string ("0x" ^ String.sub hex_string !i 2) |> char_of_int in