Skip to content

Instantly share code, notes, and snippets.

View Niraj-Fonseka's full-sized avatar
📚

Niraj Fonseka Niraj-Fonseka

📚
View GitHub Profile
@Niraj-Fonseka
Niraj-Fonseka / remove_slack_bot_from_channels.py
Created August 12, 2024 17:13
Remove a slack bot from all the channels it's added to
from slack_bolt import App
import time
app = App(token="")
resp = app.client.users_conversations()
channel_ids_to_skip = []
@Niraj-Fonseka
Niraj-Fonseka / new_ipykernel_to_vscode.md
Created May 21, 2022 19:19
adding custom python kernels for running jupyter notebooks on vscode
  • Create a new virtual env

    • virtualenv venv
  • Activate it

    • vtualenv venv/bin/activate
  • Install ipykernel

    • pip install ipykernel
  • Add the kernel to the list

@Niraj-Fonseka
Niraj-Fonseka / I2C_LCD_driver.py
Created August 17, 2021 19:46
Python I2C library for Raspberry Pi
"""
Compiled, 2021 by Niraj Fonseka
Made available under GNU GENERAL PUBLIC LICENSE
# Modified Python I2C library for Raspberry Pi
# original https://gist.github.com/DenisFromHR/cc863375a6e19dce359d by DenisFromHR
# 2021-08-16
"""
import React, { useState, useEffect } from 'react';
import './App.css';
import { SensorRequest } from "./sensorpb/sensor_pb"
import { SensorClient} from "./sensorpb/sensor_grpc_web_pb"
var client = new SensorClient('http://localhost:8000')
function App() {
const [temp, setTemp] = useState(-9999);
const [humidity , setHumidity] = useState(-99999)
import React, { useState, useEffect } from 'react';
import './App.css';
import { SensorRequest } from "./sensorpb/sensor_pb"
import { SensorClient} from "./sensorpb/sensor_grpc_web_pb"
var client = new SensorClient('http://localhost:8000')
function App() {
const [temp, setTemp] = useState(-9999);
import { SensorRequest , SensorResponse } from "./sensorpb/sensor_pb"
import { SensorClient} from "./sensorpb/sensor_grpc_web_pb"
var client = new SensorClient('http://localhost:8000')
FROM envoyproxy/envoy:v1.12.2
COPY ./envoy.yaml /etc/envoy/envoy.yaml
CMD /usr/local/bin/envoy -c /etc/envoy/envoy.yaml
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 0.0.0.0, port_value: 9901 }
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 8000 }
import React from 'react';
import './App.css';
function App() {
return (
);
}
export default App;
protoc sensor.proto \
--js_out=import_style=commonjs,binary:./../js-client/src/sensorpb \
--grpc-web_out=import_style=commonjs,mode=grpcwebtext:./../js-client/src/sensorpb