Skip to content

Instantly share code, notes, and snippets.

View iamEtornam's full-sized avatar
:octocat:
Focusing

Bright Etornam Sunu iamEtornam

:octocat:
Focusing
View GitHub Profile
@iamEtornam
iamEtornam / Readme.md
Created May 17, 2025 08:15
A comprehensive Python script that can help you identify and delete unwanted files taking up space on your MacBook.

I've created a comprehensive Python script that can help you identify and delete unwanted files taking up space on your MacBook. This script includes several features to identify different types of space-wasting files:

  • Large files - Finds files over a specified size (default 100MB)
  • Duplicate files - Identifies identical files based on content hash
  • Cache files - Locates browser caches and application caches
  • Downloads folder - Finds old files in your Downloads folder
  • Trash - Checks and empties your trash
  • Temporary files - Locates temp files and logs

How to use the script:

@iamEtornam
iamEtornam / main.dart
Created October 14, 2024 14:02
Simple animation in Flutter
import 'package:flutter/material.dart';
import 'dart:math' as math;
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@iamEtornam
iamEtornam / main.dart
Last active May 16, 2024 09:47
How to hash a large video file in Dart
import 'dart:io';
import 'dart:convert';
import 'dart:crypto';
import 'package:file/file.dart';
import 'package:stream_transform/stream_transform.dart';
///a function that takes a File object and a chosen hashing algorithm (e.g., SHA-256)
Future<String> hashFile(File file, Digest digest, int chunkSize) async {
final sink = AccumulatorSink<List<int>>();
await file.openRead().pipe(chunkStream(file, chunkSize)).pipe(transform(digest));
@iamEtornam
iamEtornam / core.dart
Created October 8, 2023 22:40
This code sample uses Records or Custom Result class to pass data and exceptions to the UI.
import 'package:example_user_app/result.dart';
import 'package:example_user_app/user.dart';
abstract class Core {
({User? user, Exception? ex}) getUser();
Result getFilterNames({required String name});
}
class CoreImpl implements Core {
User? user;
@iamEtornam
iamEtornam / algo.dart
Created March 27, 2023 18:55
Location address conversion algorithm in dart
///In this implementation, the algorithm divides the map into a grid of 0.05 degrees in width and height, which provides a ///balance between granularity and uniqueness of the address identifier. The algorithm uses a reverse geocoding API to ///retrieve the administrative area, city, and street names for the given location, and includes these components in the ///address identifier along with the grid coordinates. The format of the address identifier is designed to be human-readable ///and consistent with local addressing conventions.
String getAddressFromLocation(double latitude, double longitude) {
// Define the size of the grid in degrees
final double gridWidth = 0.05;
final double gridHeight = 0.05;
// Calculate the grid coordinates for the given latitude and longitude
final int x = ((longitude + 180) / gridWidth).floor();
final int y = ((latitude + 90) / gridHeight).floor();
@iamEtornam
iamEtornam / android_deploy.yml
Created December 12, 2022 23:16
Deploy Flutter apps to PlayStore, AppleStore and Huawei AppGallery. This was generated by ChatGPT
name: Deploy Flutter Appbundle to Play Store
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
import 'package:flutter/material.dart';
class MediaQueryExample extends StatelessWidget {
const MediaQueryExample({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final size = .of(context).size;
return Scaffold(
appBar: AppBar(title: const Text('MediaQuery Example')),
@iamEtornam
iamEtornam / layoutbuilder_example.dart
Last active October 2, 2022 11:23
How to use MediaQuery in Flutter to determine responsiveness
import 'package:flutter/material.dart';
class LayoutBuilderExample extends StatelessWidget {
const LayoutBuilderExample({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('LayoutBuilder Example')),
body: LayoutBuilder(builder: (context, constraints) {
@iamEtornam
iamEtornam / release_asset.yml
Created March 20, 2022 15:00
Github actions for Flutter app
name: Release assets
on:
release:
types: [published]
workflow_dispatch:
jobs:
release-asset:
name: Release (foss)
@iamEtornam
iamEtornam / auth_controller.dart
Last active February 15, 2022 15:38
a flutter controller with firebase auth, storage, firestore usage
```dart
import 'package:firebase_auth/firebase_auth.dart';
abstract class AuthController {
Future<bool> loginUser(String email, String password);
Future<bool> logout();
}
class AuthControllerImpl implements AuthController {