Skip to content

Instantly share code, notes, and snippets.

View kendhia's full-sized avatar
💭
Loading...

Dhia Kennouche kendhia

💭
Loading...
View GitHub Profile
@kendhia
kendhia / intercom.ts
Created March 29, 2023 13:01
Intercom integration with nextjs, in typescript.
declare global {
interface Window {
Intercom?: any;
intercomSettings?: any;
attachEvent?: any;
}
}
import { useEffect } from 'react';
import { useRouter } from 'next/router';
import json
import sys
import matplotlib.pyplot as plt
def get_test_name(test):
try:
return test["name"].split("/")[-1].split(".")[0]
except:
return test["name"]
import json
import sys
import matplotlib.pyplot as plt
def get_test_name(test):
try:
return test["name"].split("/")[-1].split(".")[0]
except:
return test["name"]
@kendhia
kendhia / response.json
Last active October 10, 2022 07:25
AWS ALB Response
{
"statusCode": 200,
// if multi-value headers is not enabled, you can use just:
// headers: {"Content-Type": "application/json"}
"multiValueHeaders": {"Content-Type": ["application/json"]},
"isBase64Encoded": false,
"body": "body"
}
@kendhia
kendhia / open_apis.json
Last active January 21, 2022 15:05
JSON of Open APIs
{
"Open Weather Map": "https://openweathermap.org/api",
"Currency Convertor": "https://exchangeratesapi.io/",
"Sky Scanner": "https://skyscanner.github.io/slate",
"IMDB": "https://rapidapi.com/apidojo/api/imdb8"
}
{
"supplier": "Workwear Express Ltd",
"amount": "105.35",
"currencyCode": "GBP",
"taxAmount": "17.56",
"dueDate": "",
"expenseDate": "",
"billReference": "",
"category": "",
"lines": [
{
"bookFileName": "1234567808-201804-KB-000000",
"bookFileXml": "PGVkZWZ0ZXI6YmVyYXQgeG1sbnM6ZWRlZnRlcj0iaHR0cDovL3d3dy5lZGVmdGVyLmdvdi50ciIgeG1sbnM6ZHM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyMiIHhtbG5zOnhhZGVzPSJodHRwOi8vdXJpLmV0c2kub3JnLzAxOTAzL3YxLjMuMiMiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhzaTpzY2hlbWFMb2NhdGlvbj0iaHR0cDovL3d3dy5lZGVmdGVyLmdvdi50ciAuLi94c2QvZWRlZnRlci54c2QiPgoJPHhicmxpOnhicmwgeG1sbnM6Z2wtYnVzPSJodHRwOi8vd3d3Lnhicmwub3JnL2ludC9nbC9idXMvMjAwNi0xMC0yNSIgeG1sbnM6Z2wtY29yPSJodHRwOi8vd3d3Lnhicmwub3JnL2ludC9nbC9jb3IvMjAwNi0xMC0yNSIgeG1sbnM6Z2wtcGx0PSJodHRwOi8vd3d3Lnhicmwub3JnL2ludC9nbC9wbHQvMjAwNi0xMC0yNSIgeG1sbnM6aXNvNDIxNz0iaHR0cDovL3d3dy54YnJsLm9yZy8yMDAzL2lzbzQyMTciIHhtbG5zOmlzbzYzOT0iaHR0cDovL3d3dy54YnJsLm9yZy8yMDA1L2lzbzYzOSIgeG1sbnM6bGluaz0iaHR0cDovL3d3dy54YnJsLm9yZy8yMDAzL2xpbmtiYXNlIiB4bWxuczp4YnJsaT0iaHR0cDovL3d3dy54YnJsLm9yZy8yMDAzL2luc3RhbmNlIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CgkJPGxpbms6c2NoZW1hUmVmIHhsaW5rOmh
@kendhia
kendhia / roadsAndLibraries.py
Created November 1, 2020 14:05
My solution for the roads and libraries graph problem. https://www.hackerrank.com/challenges/torque-and-development
from collections import defaultdict
def dfs(visited_dfs, graph_dfs, node, l_c):
# This is the usual dfs algorithm
# just we need to keep count of the length of our component (l_c)
if node not in visited_dfs:
l_c += 1
visited_dfs.add(node)
for neighbour in graph_dfs[node]:
l_c = dfs(visited_dfs, graph_dfs, neighbour, l_c)
{
"parameters": [
{
"key": "",
"value": ""
}
],
"requestHeader": {
"channelId": "",
"channelType": "MOBILE",
@kendhia
kendhia / hw.py
Last active October 20, 2020 20:03
class File:
def __init__(self, id, name) -> None:
self.id = id
self.name = name
def __eq__(self, other):
return self.id == other
def __repr__(self):
return f"Name: {self.name} ID: {self.id}"