Skip to content

Instantly share code, notes, and snippets.

View reza-ryte-club's full-sized avatar

Reza reza-ryte-club

View GitHub Profile
@reza-ryte-club
reza-ryte-club / Grafana Dashboard.json
Created December 8, 2023 08:10
Grafana Dashboard
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
var bitOne = 0b00000001
var maskingBit = 0b00000000
// Retrieve the state of the bit of the first digit from right side of bitOne
print(String(bitOne|maskingBit, radix: 2)) // Print 1, which indicates the first digit from the right of bitOne is 1
// Turn on the first digit of bitOne no matter what the previous bit was
bitOne = bitOne|maskingBit
// Turn off the first digit of bitOne
let bitOne = 0b100111
let bitTwo = 0b101000
print(String(bitOne<<2, radix: 2)) // Print the output 10011100
print(String(bitOne>>2, radix: 2)) // Print the output 1001
let bitOne = 0b100111
let bitTwo = 0b101000
print(String(bitOne^bitTwo, radix: 2)) // Print the binary XOR output 1111 which is actually 01111
let bitOne:UInt8 = 0b01101110
print(String(~bitOne, radix:2)) // Output 10010001
let bitOne = 0b100111
let bitTwo = 0b101000
print(String(bitOne|bitTwo, radix: 2)) // Print the binary OR output 101111
let bitOne = 0b100111
let bitTwo = 0b101000
print(String(bitOne&bitTwo, radix: 2)) // Print the binary AND output 100000
<script src=”/socket.io/socket.io.js”></script>
<script>
$(document).ready(() => {
var socket = io();
socket.on(‘generated notification’, notificationString => {
// show the notification
var notification
= new Notification(‘Notification,{
title: ‘notificationString’,
});
// /app/sockets/receivers.server.sockets.js
var socketIO;
exports.receivers = (io) => {
socketIO = io;
io.emit(‘generated notification’,’hello’);
}
// handle different type of notification.
var io=null;
exports.set = function(socketio) {
io=socketio;
};
exports.get = function() {
return io;
};