Skip to content

Instantly share code, notes, and snippets.

View NemesisX1's full-sized avatar
πŸ€–
Learning tech and product

Elikem Medehou NemesisX1

πŸ€–
Learning tech and product
View GitHub Profile
@NemesisX1
NemesisX1 / load_dotenv.sh
Created August 3, 2023 15:43 — forked from mihow/load_dotenv.sh
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
@NemesisX1
NemesisX1 / positionstack.dart
Last active November 13, 2022 08:44
A way to get localisation coords
import 'dart:developer';
import 'package:dio/dio.dart';
class PointStackLocation {
double? latitude;
double? longitude;
String? type;
double? distance;
String? name;
double? confidence;
@NemesisX1
NemesisX1 / postgres_docker-compose.yml
Created June 27, 2022 13:39
A Compose file to launch postgresql instance
version: '3.8'
services:
db:
container_name: pg_container
image: postgres
restart: always
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: test_db
@NemesisX1
NemesisX1 / mongodb_docker-compose.yml
Created June 27, 2022 13:37
A compose file to create and deploy a mongodb instance
version: '3.7'
services:
mongodb_container:
image: mongo:latest
ports:
- 27017:27017
volumes:
- mongodb_data_container:/data/db
volumes:
@NemesisX1
NemesisX1 / flutter_web_csv_picker.dart
Last active June 15, 2022 16:58
A simple way to retrieve CSV and read its contents on Flutter Web
// Note: This is a simple way to read CSV file with Flutter Web
// You must add those packages to make the code work:
// - csv
// - file_picker_web
Future<void> importCSV() async {
// Using the file_picker_package to get the file
final csvFile = await FilePicker.platform.pickFiles(
allowMultiple: false,
withData: true,
@NemesisX1
NemesisX1 / cloudinary_react_file_upload.js
Last active April 30, 2022 07:28
A simple way to upload file to Cloudinay from React frontend with Axios
async uploadFile(file) {
const url = `https://api.cloudinary.com/v1_1/${process.env.CLOUDINAY_CLOUD_NAME}/upload`;
const fd = new FormData();
fd.append(
"upload_preset",
process.env.PRESET_ID
);
fd.append("tags", "browser_upload");
fd.append("file", file);
@NemesisX1
NemesisX1 / hive_service_snippet.dart
Last active February 22, 2022 21:08
A collection of snippets to speed up your development using Hive as a database in Dart with/without Flutter.
import 'dart:developer';
import 'package:hive/hive.dart';
/// A simple class to store as static strings your boxes names
class HiveClassName {
static const String user = "user";
}
/// I often add those lines:
/// try {
@NemesisX1
NemesisX1 / branch_deleter.sh
Created February 11, 2022 16:42
A script to delete every remote branch apart of the master one
#!/bin/bash
# We retrieve all remote branches avalaible
values=$(git branch -r)
# Split them everytime we find a space character ' ' to get an array
values_array=(${values//' '/ })
# Then get the length of the array
length=${#values_array[@]}