Skip to content

Instantly share code, notes, and snippets.

View bikathi's full-sized avatar
🎯
Focusing

Bikathi Martin bikathi

🎯
Focusing
View GitHub Profile

Awesome Crates for Rust Project

These crates have been put here in no particular order, and are updates as I come scross them in other people's projects and in my own.

Crate Use
rand Random number generator
fern Logging for Rust
@bikathi
bikathi / cheat.txt
Created June 29, 2025 15:50
Rust Formatting Strings Cheat Sheet
{}: Replaces with the next argument, automatically converting it to a string.
{:?}: Uses the Debug trait to display the value. Useful for displaying complex data structures.
{:#?}: Pretty-prints the Debug output (useful for structs and enums).
{:<width}: Left-aligns the output within the specified width.
{:>width}: Right-aligns the output.
{:^width}: Centers the output.
{:.precision}: Limits the number of decimal places for floating-point numbers.
{:<0width}: Pads with zeros on the left.
{:#x}: Formats an integer as hexadecimal with the 0x prefix.
@bikathi
bikathi / Scope.java
Created March 8, 2025 13:20
Using ENUMs in Java With Custom Values
public enum Scope {
Accounting("ACCOUNTING"),
Payments("PAYMENTS"),
AccountingPayments("ACCOUNTING_PAYMENTS"),
OpenId("OPENID"),
Profile("PROFILE"),
Phone("PHONE"),
Address("ADDRESS"),
Email("EMAIL"),
OpenIdAll("OPENID_ALL"),
@bikathi
bikathi / ValuationApplication.java
Created January 29, 2025 10:00
How to read JSON from inside /res folder of Spring Boot
public class ValuationApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(ValuationApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
ObjectMapper objectMapper = new ObjectMapper();
ClassPathResource resource = new ClassPathResource("bootstrap-config.json");
@bikathi
bikathi / App.vue
Created August 13, 2023 10:38
How To Use V-Auto-Animate and Dicebear in VueJS
<script setup>
import { ref } from 'vue';
import { createAvatar } from '@dicebear/core';
import { croodles } from '@dicebear/collection';
const items = ref(['😏', '😐', '😑', '😒', '😕']);
const avatar = createAvatar(croodles, {
size: 128,
seed: 'Solomon Kane',
// ... other options
}).toDataUriSync();
@bikathi
bikathi / file-upload.html
Created July 17, 2023 07:33
Custom File Upload Input Box In HTML and Tailwind3
<div class="w-full md:w-1/2 px-3 md:mb-0">
<label for="photos" class="text-lg">Upload Company Logo</label>
<label for="dropzone-file"
class="mt-2 flex flex-col items-center justify-center
border-2 border-gray-300 border-dashed
cursor-pointer dark:hover:bg-bray-800
dark:bg-gray-700 hover:bg-gray-100 dark:border-gray-600
dark:hover:border-gray-500 dark:hover:bg-gray-600">
<div class="flex flex-col items-center justify-center pt-5 pb-6">
<svg aria-hidden="true" class="w-10 h-10 mb-3 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
@bikathi
bikathi / logback.xml
Last active December 19, 2022 17:05
Spring SLF4J Logging Configuration File
<configuration>
<!-- Setting up log path and log file name -->
<property name="LOG_PATH" value="./logs"/>
<property name="LOG_FILE_NAME" value="application_logback"/>
<!-- Setting up logging pattern for console logging -->
<appender name="ConsoleOutput" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern> %white(%d{ISO8601}) %highlight(%-5level) [%yellow(%t)] : %msg%n%throwable </Pattern>
</layout>
</appender>
@bikathi
bikathi / MailingService.java
Last active November 22, 2022 10:22
Spring5 Example to Send Simple Text Email and MIME Email with Attachment
package com.hobbyzhub.userservice.service;
import com.hobbyzhub.userservice.event.SendVerificationMailEvent;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;