Skip to content

Instantly share code, notes, and snippets.

View shobhitchittora's full-sized avatar
🏠
Working from home

Shobhit Chittora shobhitchittora

🏠
Working from home
View GitHub Profile
const grpc = require('grpc');
const loader = require('@grpc/proto-loader');
const todos = require('./todos_db.json');
class TodoAppHandler {
getAll(_, callback) {
return callback(null, todos);
}
getTodo(call, callback) {
const grpc = require('grpc');
const loader = require('@grpc/proto-loader');
const bindPath = '0.0.0.0:8080';
loader.load('todo.proto', { includeDirs: ['./src'] })
.then((packageDefinition) => {
const package = grpc.loadPackageDefinition(packageDefinition);
const Client = package.todo_app_package.TodoApp;
const client = new Client(bindPath, grpc.credentials.createInsecure());
@shobhitchittora
shobhitchittora / event_loop.js
Last active October 21, 2018 07:49
Event Loop suedo-code
// my JS code
// node index.js
index.runCode();
// Node JS event loop
var pendingTimers = [];
var pendingOSTasks = [];
var pendingOperations = [];
@shobhitchittora
shobhitchittora / cancer.js
Last active December 15, 2019 20:32
Classification-Caner
const tf = require('@tensorflow/tfjs-node');
const TRAINING_DATA_URL = 'https://raw.githubusercontent.com/lmoroney/dlaicourse/master/TensorFlow%20Deployment/Course%201%20-%20TensorFlow-JS/Week%201/Exercise/wdbc-train.csv';
const TESTING_DATA_URL = 'https://raw.githubusercontent.com/lmoroney/dlaicourse/master/TensorFlow%20Deployment/Course%201%20-%20TensorFlow-JS/Week%201/Exercise/wdbc-test.csv';
async function run() {
// diagnosis column in the labelled csv
// has all the decisioning data
const trainingData = tf.data.csv(
TRAINING_DATA_URL, {
@shobhitchittora
shobhitchittora / rfc-gql-error.md
Last active April 11, 2020 23:24
[RFC] Standard Error Codes

This RFC is an attempt to identify and standardize error codes for GraphQL errors. This has bee previously discussed, and some great work and ideas came out of it. Follow the previous discussion here - #698

Why standard error codes ?

Errors ( error codes ) are the silent guardians in the programming world. Though no one wants them in their code, they actually teach us a lot and mold our thinking process. This is especially true for statically typed compiled languages like c, rust etc, where the compiler scolds and guides the programmer to fix the program's syntax. A few strong argument for having a standard set of error codes for GraphQL can be -

  1. A well documented set of errors would help developers get a better understanding of the issues and errors during development.
  2. Potential suggestions to fix these errors would help developer productivity too.
  3. As the spec matures, this would force holistic system thinking and help catch outliers and p
@shobhitchittora
shobhitchittora / commands.txt
Last active February 23, 2023 19:12
Mi tab Bloatware removal
cd C:\platform-tools\
./adb shell pm uninstall -k --user 0 com.miui.gallery
./adb shell pm uninstall -k --user 0 com.miui.calculator
./adb shell pm uninstall -k --user 0 com.xiaomi.calendar
./adb shell pm uninstall -k --user 0 com.miui.notes
./adb shell pm uninstall -k --user 0 com.miui.player
./adb shell pm uninstall -k --user 0 com.xiaomi.scanner
./adb shell pm uninstall -k --user 0 com.xiaomi.account
./adb shell pm uninstall -k --user 0 com.xiaomi.payment