Skip to content

Instantly share code, notes, and snippets.

View vedraiyani's full-sized avatar

Chintan Raiyani vedraiyani

  • SAP Labs
  • Bangalore, India
View GitHub Profile
@vedraiyani
vedraiyani / HelloWorld.java
Created July 1, 2021 05:30
Understand how lambda works in java
import java.util.Arrays;
import java.util.function.Function;
import java.util.function.IntConsumer;
public class HelloWorld{
// https://blogs.oracle.com/javamagazine/behind-the-scenes-how-do-lambda-expressions-really-work-in-java
// javac .\HelloWorld.java
// javap -p -c HelloWorld$1
String sum="";
public static void main(String []args){
new HelloWorld().main(); //comment then uncomment below comments also
import alpaca_trade_api as tradeapi
import time
import datetime
from datetime import timedelta
from pytz import timezone
tz = timezone('EST')
import numpy as np
import pandas as pd
@vedraiyani
vedraiyani / RedisJava.java
Created June 23, 2021 12:13
Use Redis in java
import java.util.ArrayList;
import java.util.List;
import redis.clients.jedis.Jedis;
public class RedisJava {
public static void main(String[] args) {
// Connecting to Redis server on localhost
Jedis jedis = new Jedis("localhost", 8083);
@vedraiyani
vedraiyani / DefaultExceptionHandler.java
Last active June 23, 2021 11:41
Demo for default/global exception handler
public class DefaultExceptionHandler implements Runnable {
public void run() {
//throw new RuntimeException();
new Test().err();
}
public static void main(String[] args) {
Thread thread = new Thread(new DefaultExceptionHandler());
thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler(){
@vedraiyani
vedraiyani / Google Colab SSH
Created July 17, 2020 11:16 — forked from yashkumaratri/Google Colab SSH
SSH into google colab
#CODE
#Generate root password
import random, string
password = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(20))
#Download ngrok
! wget -q -c -nc https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
! unzip -qq -n ngrok-stable-linux-amd64.zip
#Setup sshd
@vedraiyani
vedraiyani / slack_notifier.py
Created February 26, 2020 05:25 — forked from abhishekkrthakur/slack_notifier.py
Slack notification from python
import os
import requests
import json
SLACK_WEBHOOK= os.environ.get("SLACK_WEBHOOK")
def send_message(messages, channel="abhishek", username="beast"):
"""
:param messages: list of texts
def plot_eli5_top_explanations(
model: Model,
image: np.array,
class_names_mapping: Dict[int, str],
top_preds_count: int = 3,
fig_name: Optional[str] = None
) -> None:
image_columns = 3
image_rows = math.ceil(top_preds_count / image_columns)
@vedraiyani
vedraiyani / portainer.md
Created November 17, 2019 05:25 — forked from SeanSobey/portainer.md
Portainer Setup on Windows 10

Portainer on Windows 10

Here I have 2 methods for running portainer on windows, a quick, preferred method only requiring a fairly recent version of docker, or a more complicated method to try if that does not work.

Using docker.for.win.localhost

This setup will let you run Portainer on windows by using the docker.for.win.localhost endpoint.

Please note:

@vedraiyani
vedraiyani / nodejs-rfid.js
Created October 16, 2019 10:51 — forked from basham/nodejs-rfid.js
Use NodeJS to read RFID ids through the USB serial stream.
/*
DESCRIPTION
-----------
Use NodeJS to read RFID ids through the USB serial stream. Code derived from this forum:
http://groups.google.com/group/nodejs/browse_thread/thread/e2b071b6a70a6eb1/086ec7fcb5036699
CODE REPOSITORY
---------------
https://gist.github.com/806605