Skip to content

Instantly share code, notes, and snippets.

View SergeWilfried's full-sized avatar
💭
I may be slow to respond.

SergeWilfried SergeWilfried

💭
I may be slow to respond.
View GitHub Profile
@SergeWilfried
SergeWilfried / React-Junior.md
Created June 26, 2025 13:35
React.js Junior Developer Technical Test

⚛️ React.js Junior Developer Technical Test

⏱️ Time Limit: 2.5 hours
📝 Instructions: Complete as many tasks as possible. Focus on clean, functional React components with proper state management.

📋 Prerequisites

  • Node.js (16+) and npm/yarn installed
  • Basic knowledge of JavaScript ES6+ and React fundamentals
  • Understanding of HTML, CSS, and modern web development
@SergeWilfried
SergeWilfried / node-test.md
Last active June 26, 2025 16:38
Technical Test

🚀 Express.js Junior Developer Technical Test

📝 Instructions: Focus on creating a clean, working Express.js server with proper setup and basic functionality.

📋 Prerequisites

  • Node.js and npm installed
  • Basic knowledge of JavaScript ES6+
  • Understanding of REST API concepts
@SergeWilfried
SergeWilfried / inspect.py
Created January 15, 2025 14:16
Solar Site Inspection
import supervision as sv
import numpy as np
from inference_sdk import InferenceHTTPClient, InferenceConfiguration
from pathlib import Path
from typing import Optional
# Constants should be in UPPERCASE and at the top
API_URL = "https://detect.roboflow.com"
MODEL_ID = "solar-panel-hotspot-detection-dgiy8/2"
CONFIDENCE_THRESHOLD = 0.15
@SergeWilfried
SergeWilfried / revenue_klaviyo.js
Created July 12, 2024 17:41
A draft of a solution to fix Revenue Reports from Klaviyo
Fix invalid Klaviyo Revenue Reports
1. [] Format Stripe Historical data From BigQuery and sync to Klaviyo Using a script
2. [] Setup a daily cron job to Query most recent Stripe charges from
Bigquery and sync to Klaviyo using n8n
/// One time Event Format
{
"type": "event",
"attributes": {
@SergeWilfried
SergeWilfried / crm-syncv2.js
Created July 12, 2024 10:15
Refactoring Klaviyo Sync Function
const sentry = require("@sentry/node");
const admin = require('firebase-admin');
const sentryDsn = process.env.SENTRY_DSN;
const env = process.env.NODE_ENV;
const scope = new sentry.Scope();
admin.initializeApp({
credential: admin.credential.applicationDefault(),
databaseURL: 'https://timeleft-16fe7.firebaseio.com'
});
@SergeWilfried
SergeWilfried / query_exchange_rate.js
Created July 12, 2024 09:41
Query Exchange Rate From BigQuery
// #### Purpose
// The purpose of this query is to update the `purchase_price_in_eur` field in
// the `project-id.firestore_stream.payments_revenuecat_daily_exports` table.
// The `purchase_price_in_eur` is calculated based on the `purchase_price_in_usd` and
// the most recent EUR to USD exchange rate available in the `historical_eur_to_usd`
// table. If the exchange rate for a specific date is not present, the query uses the
// most recent available exchange rate before that date.
UPDATE `project-id.firestore_stream.table` AS t
const {
stripe,
bigquery,
datasetId,
nonRefundedTableId,
RefundTableId,
STRIPE_LIMIT,
sentryDsn,
bucketName,
endpointSecret
@SergeWilfried
SergeWilfried / get_and_convert_currencies.ts
Created July 2, 2024 13:21
currency convertion logic
async function getUniqueCurrencies({
datasetId,
tableId,
bigQuery,
source,
}: {
datasetId: string,
tableId: string,
bigQuery: BigQuery,
source: string,
async function saveProfilesToKlaviyo(profiles, sequenceNumber = 0) {
const url = 'https://a.klaviyo.com/api/profile-bulk-import-jobs/';
const klaviyoApiKey = 'API_KEY'; // Replace with your actual Klaviyo API key
console.log('sequenceNumber', sequenceNumber);
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Klaviyo-API-Key ${klaviyoApiKey}`,
@SergeWilfried
SergeWilfried / checkUserCusID.js
Created June 27, 2024 08:07
Code snippet to update users record with missing cusID
const checkUserCusID = async () => {
const filePath = path.join(__dirname, 'bq_users.json');
const data = fs.readFileSync(filePath, 'utf8');
const users = JSON.parse(data);
let invalidUsers = [];
let validUsers = [];
let batch = db.batch();
for (const user of users) {
const userEmail = user.Customer_Email;