Skip to content

Instantly share code, notes, and snippets.

View YohannesTz's full-sized avatar
🎯
Mostly Exploring, Cleaning up unfinished projects

Yohannes Tezera YohannesTz

🎯
Mostly Exploring, Cleaning up unfinished projects
View GitHub Profile
@YohannesTz
YohannesTz / RatingView.kt
Created June 8, 2024 18:00
RatingView for android that has an emoji effect
package com.github.yohannestz.visionedu.view.customview
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.*
import android.util.AttributeSet
import android.view.View
class RatingView @JvmOverloads constructor(
context: Context,
bookRepository.getChapaLink = async (userId, bookId) => {
let result = {
success: false,
error: null,
checkoutUrl: null
};
try {
// Retrieve the book details by bookId
const book = await bookRepository.getById(bookId);
@YohannesTz
YohannesTz / index.js
Created May 6, 2024 11:37
System info for Nodejs host app
const os = require('os');
const si = require('systeminformation');
const getHardwareHealth = async () => {
const cpu = os.cpus();
const totalMemoryBytes = os.totalmem();
const freeMemoryBytes = os.freemem();
const totalMemoryMb = Math.round(totalMemoryBytes / 1024 / 1024);
const freeMemoryMb = Math.round(freeMemoryBytes / 1024 / 1024);
const platform = os.platform();
@YohannesTz
YohannesTz / LabeledSwitch.kt
Created April 17, 2024 13:48
Doing this cause I am fucking tired of gradle conflicts... original source belongs to https://github.com/singhangadin/android-toggle/
/*
* Copyright (c) 2024. YohannesTz, Africa Technologies PLC
*/
import android.animation.ValueAnimator
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.RectF
@YohannesTz
YohannesTz / add_copyright_notice.sh
Created April 15, 2024 07:23
Simple scripts to add and remove copyright notice headers in Java and Kotlin files
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bgcover"
android:orientation="vertical"
tools:context=".MainActivity">
@YohannesTz
YohannesTz / Auth_Util.php
Created April 7, 2024 14:43
FCM utility for PHP.
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Auth_Util {
private $firebaseConfig;
private $scope;
public function __construct() {
$this->CI =& get_instance();
$this->CI->load->library('FirebaseServiceConfig');
@YohannesTz
YohannesTz / package_resolver.sh
Created March 14, 2024 17:42
a Simple script to resolve java files into their respective folder/package structure
# usage
chmod +x package_resolver.sh
./pacakge_resolver.sh /input/folder /output/folder
@YohannesTz
YohannesTz / generate_gpx.sh
Created March 2, 2024 09:56
a simple script to generate GPX file from an array of LatLon points and save it to track.gpx file
#!/bin/bash
coordinates=("$@")
# Start GPX file
echo '<?xml version="1.0" encoding="UTF-8"?>' > track.gpx
echo '<gpx version="1.1" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">' >> track.gpx
echo '<trk>' >> track.gpx
echo '<trkseg>' >> track.gpx
@YohannesTz
YohannesTz / configure_my_olddesktop_Res.sh
Last active February 9, 2024 19:51
Daily chore commands for my self and my potato pc.
# a command to adjust a screen to 1440x900_60.00
# first do this to get the data
cvt 1440 900
# then take the output and do this
xrandr --newmode "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
# now add this mode to the monitor
xrandr --addmode DP-2 "1440x900_60.00"