Skip to content

Instantly share code, notes, and snippets.

View samuelowino's full-sized avatar
👨‍💻

Samuel Owino samuelowino

👨‍💻
View GitHub Profile

1️⃣. Add this script to the root your the project directory

#!/bin/bash

REPORT="target/site/jacoco/jacoco.xml"
README="README.md"
TMPFILE=".coverage.tmp"

if [ ! -f "$REPORT" ]; then
  echo "❌ JaCoCo XML report not found at $REPORT"
@samuelowino
samuelowino / factors.c
Created September 25, 2024 19:57
Looking for factors of large numbers can be annoying
#include <stdio.h>
int main(){
int _pn = 0; // Product
int _sn = 0; // Sum
printf("========================================================");
printf("Factors Generator");
printf("========================================================");
printf("\n⌨️Enter the product whose factors you need\n\n");
printf("\n");
@samuelowino
samuelowino / polyproblems.md
Created September 4, 2024 04:01
Operations on Polynomial Problems

Sure! Here are the practice exercises without solutions or explanations.


Polynomial Operations Practice

1. Dividing Polynomials Using Long Division

Exercise 1

Divide $3x^4 - 5x^3 + 2x^2 - 8x + 6$ by $$ x^2 - 2x + 1 $$

@samuelowino
samuelowino / OpengraphUI.swift
Created August 11, 2024 21:25
OpenGraph Swift Lib Sample
//
// ContentView.swift
// OpenGraphTrials
//
// Created by Samuel Owino on 11/08/2024.
//
import SwiftUI
import OpenGraph
struct ContentView: View {
@State var ogMetaModel = OpengraphMetaModel()
@samuelowino
samuelowino / thumbnail-generator.swift
Last active January 17, 2024 07:24
AVAssetGenerator | AVFoundation
/// Generator single thumbnail from video asset
func generateImageThumbnail(videoAsset: AVAsset) async throws -> UIImage {
let generator = AVAssetImageGenerator(asset: videoAsset)
generator.requestTimeToleranceBefore = .zero
generator.requestTimeToleranceAfter = CMTime(seconds: 3, preferedTimeScale: 600)
let thumbnail = try await generator.image(at: time).image
return UIImage(cgImage: thumbnail)
}
@samuelowino
samuelowino / git-commit-template.md
Created December 22, 2023 17:22 — forked from lisawolderiksen/git-commit-template.md
Use a Git commit message template to write better commit messages

Using Git Commit Message Templates to Write Better Commit Messages

The always enthusiastic and knowledgeable mr. @jasaltvik shared with our team an article on writing (good) Git commit messages: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the

Java Predicate is a functional interface that represents a boolean-valued function. It can be used to define conditions or filters.

  1. Filtering a List:
import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;

public class Main {
@samuelowino
samuelowino / white_status_bar.java
Created November 15, 2022 08:15
White Status Bar
if (!ThemeUtils.getDarkModeThemeEnabled(getApplicationContext())) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
@samuelowino
samuelowino / review_request.swift
Created October 23, 2022 07:52
Request Review
// If the app doesn't store the count, this returns 0.
var count = UserDefaults.standard.integer(forKey: UserDefaultsKeys.processCompletedCountKey)
count += 1
UserDefaults.standard.set(count, forKey: UserDefaultsKeys.processCompletedCountKey)
print("Process completed \(count) time(s).")
// Keep track of the most recent app version that prompts the user for a review.
let lastVersionPromptedForReview = UserDefaults.standard.string(forKey: UserDefaultsKeys.lastVersionPromptedForReviewKey)
// Get the current bundle version for the app.
@samuelowino
samuelowino / deference.swift
Created August 19, 2022 07:18
Defer statements
import Foundation
enum BadRequestException: Error {
case NetworkRequestFailed(cause: String)
}
struct NetworkConnection {
var openStatus: Bool
}