Skip to content

Instantly share code, notes, and snippets.

@Amit2016-17
Amit2016-17 / monte_carlo.py
Created January 10, 2022 12:53 — forked from artlung/monte_carlo.py
Monte Carlo Python Program
"""Run a Monte Carlo simulation to validate the lottery example."""
import random
from lottery import winner, PEOPLE
def simulate(runs, f=winner, arg=PEOPLE):
"""Simulate function f with argument arg with number of given runs."""
# Store the number of results in a dict.
result_counts = {} # this is a dict
@Amit2016-17
Amit2016-17 / model_service.yaml
Created March 10, 2021 11:14 — forked from PatrickKalkman/model_service.yaml
model service definition in the docker compose yaml
model-service:
image: x86_64/cassava-model-service:0.8.1
container_name: model-service
environment:
MODEL_NAME: saved_model
networks:
- pred-network
@Amit2016-17
Amit2016-17 / app.py
Created February 21, 2021 14:41 — forked from PulkitS01/app.py
ML_model_deployment_streamlit.py
%%writefile app.py
import pickle
import streamlit as st
# loading the trained model
pickle_in = open('classifier.pkl', 'rb')
classifier = pickle.load(pickle_in)
@st.cache()
@Amit2016-17
Amit2016-17 / micropython i2c scanner
Created December 4, 2020 06:04 — forked from projetsdiy/micropython i2c scanner
Micropython i2c scanner
# Scanner i2c en MicroPython | MicroPython i2c scanner
# Renvoi l'adresse en decimal et hexa de chaque device connecte sur le bus i2c
# Return decimal and hexa adress of each i2c device
# https://projetsdiy.fr - https://diyprojects.io (dec. 2017)
import machine
i2c = machine.I2C(scl=machine.Pin(5), sda=machine.Pin(4))
print('Scan i2c bus...')
devices = i2c.scan()
/* Sample data */
insert into emp (EMPID, NAME, JOB, SALARY)
values
(201, 'ANIRUDDHA', 'ANALYST', 2100),
(212, 'LAKSHAY', 'DATA ENGINEER', 2700),
(209, 'SIDDHARTH', 'DATA ENGINEER', 3000),
(232, 'ABHIRAJ', 'DATA SCIENTIST', 2500),
(205, 'RAM', 'ANALYST', 2500),
(222, 'PRANAV', 'MANAGER', 4500),
(202, 'SUNIL', 'MANAGER', 4800),
function createRTCPeerConnection(){
connection = new RTCPeerConnection(configuration);
// Add both video and audio tracks to the connection
for (const track of localStream.getTracks()) {
log("Sending Stream.")
existingTracks.push(connection.addTrack(track, localStream));
}
// This event handles displaying remote video and audio feed from the other peer
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>WebRTC Video Chat</title>
<style>
#videoContainer {
function createAndSendOffer(){
if(channel){
channel.close();
}
// Create Data channel
channel = connection.createDataChannel('channel', {});
setChannelEvents(channel);
// Create Offer
@Amit2016-17
Amit2016-17 / seed_mysql.ipynb
Created November 5, 2020 14:20 — forked from zorteran/seed_mysql.ipynb
Write some data to MySQL
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
......
@override
Widget build(BuildContext context) {
String bgImage = now.hour > 6 && now.hour < 19 ? "assets/day.png" : "assets/night.jpg";
return Scaffold(
body: Container(
decoration: BoxDecoration(
image: DecorationImage(