Skip to content

Instantly share code, notes, and snippets.

View Itsdenty's full-sized avatar

Abd-afeez Abd-hamid Adedamola Itsdenty

  • Robotic Systems Lagos
  • Nigeria
View GitHub Profile
@Itsdenty
Itsdenty / gist:047bb96f4baea2120074cba8f95288f2
Created January 22, 2024 13:49
Server-side Logging in Javascript with Winston Library
Introduction
At local development, you have access to the console. This allows you to;
Recreate errors.
Peruse stack traces.
Interpret cryptic error messages.
and debug.
However, at the production stage, you don’t have access to those console messages because your apps run on users’ machines (i.e. mobile, web, desktop). In this case, having some ways to record your code’s various error messages from the client and to a server, you have access to would be beneficial. There are many tools available for such use cases, typically called logging libraries, but this article won’t cover all of them. The focus of this article is on Winston library. Ready to get started?
Table of contents.
What is Logging
Type of data to save in your log
@Itsdenty
Itsdenty / gist:f60145bbe7c7dae4bd0428e517b9b0e1
Created January 21, 2024 15:26
A simple bash utility to abstract kubernets access
#!/bin/bash
# set -x;
team=$(whoami)
# echo $team
all=0
if [ $# -eq 0 ]
then
echo "No arguments supplied use the -h flag for help"
exit 1
fi
@Itsdenty
Itsdenty / gist:ac3d897ed27aa84bd7d8c1d34ae057cc
Created January 21, 2020 14:29
The xpress test solution json
{
"_id": {
"$oid": "5e2707d1f4e57627565aeeae"
},
"registrationDate": {
"$date": "2020-01-21T14:16:49.714Z"
},
"customerName": "Akintola",
"email": "akt@gmail.com",
"phoneNumber": "08016789081",
@Itsdenty
Itsdenty / hashtable.c
Last active April 20, 2018 06:09
An implementation of the harsh table in c
#include <stdio.h>
#include <string.h>
/* entry_s is the structure declaration for storing a single key and value node*/
struct entry_s {
char not_empty;
char key[7];
char val[16];
};
/* creates a declaration keyword for the entry_s custom structure */
typedef struct entry_s entry_t;
@Itsdenty
Itsdenty / prime check.py
Created June 23, 2016 16:48
python prime number check function
def prime_number(x):
if x <2:
return False
if x==2:
return True
if not x & 1:
return False
for n in range (3,int(x**0.5)+1,2):
if x%n == 0:
return False
@Itsdenty
Itsdenty / feet to centimeter.js
Created May 20, 2016 17:19
the assignment on feet to centimeter
function toCentimetre(feet) {
feet /= 33;
var centimetre = feet;
return centimetre;
}