Skip to content

Instantly share code, notes, and snippets.

View samarlyka's full-sized avatar
👁️‍🗨️
Currently looking at a bunch of code...

Samarthya Lykamanuella samarlyka

👁️‍🗨️
Currently looking at a bunch of code...
View GitHub Profile
@samarlyka
samarlyka / microgpt.py
Created February 20, 2026 18:29 — forked from karpathy/microgpt.py
microgpt
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@samarlyka
samarlyka / arduino_sample_project.ino
Last active July 2, 2025 03:57
Instrumentasi (FQ018) TA 2024/2025-3 UKSW - Membaca Serial Output Arduino Menggunakan Python
/**
* By Samarthya Lykamanuella on 2023-10-15
* SOURCE: https://www.circuitbasics.com/how-to-use-photoresistors-to-detect-light-on-an-arduino/
*/
int PHOTO_PIN = A0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
@samarlyka
samarlyka / ImagePainterFromFile.kt
Created July 19, 2024 13:06
Kotlin: Load External Image in Jetpack Compose without Coil or Glide Dependencies
/**
* This class allows one to display an external image in Kotlin Jetpack Composable
* without external dependencies such as Coil and Glide.
* Written by Samarthya Lykamanuella (github.com/groaking)
* ---
* Load an ImageBitmap from a specific path, then convert it into a Painter
* that can be loaded in a composable Image element.
* SOURCE: https://developer.android.com/develop/ui/compose/graphics/images/custompainter
*/
@samarlyka
samarlyka / command-ffmpeg.sh
Created October 12, 2023 09:25
OOMMF Conversion of Micrographs into MP4 File (Aug 24, 2023)
#!/bin/sh
# Converts an array of images into an MP4 video
# SOURCE: https://askubuntu.com/a/610945
base="/ssynthesia/ghostcity/git-local/02306.00013-neptunal-ix-oommf-nanoparticle/ix-meh-10/magick-export"
fps=60
output_path="/ssynthesia/ghostcity/git-local/02306.00013-neptunal-ix-oommf-nanoparticle/ix-meh-10/dist/"
ffmpeg -framerate $fps -i $base/overlaid-micrograph-%07d.png -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p $output_path/ffmpeg-output-$fps"fps".mp4
@samarlyka
samarlyka / plotting-data-oommf.py
Created September 30, 2023 18:01
Kode Sumber - Tutorial Visualisasi 2D Data OOMMF Menggunakan Python Matplotlib
import pandas as pd
import matplotlib.pyplot as plt
file_masukan = "Permalloy Nanowire 200nm.csv"
data_terbaca = pd.read_csv(file_masukan)
x = data_terbaca["Oxs_TimeDriver::Simulation time"]
y = data_terbaca["Oxs_UniformExchange:NiFe:Energy"]
y2 = data_terbaca["Oxs_Demag::Energy"]
@samarlyka
samarlyka / plotting-data-time-to-time.py
Last active September 30, 2023 17:58
Kode Sumber - Tutorial Plotting Data Simulasi OOMMF dari Waktu ke Waktu
import matplotlib.pyplot as plt
import pandas as pd
# Alamat tempat berkas CSV berada
wd = '/ssynthesia/ghostcity/git-local/02306.00013-neptunal-ix-oommf-nanoparticle/ix-meh-12/'
# Berkas CSV masukan
csv = '200nm.csv'
# Membaca berkas CSV hasil simulasi OOMMF