Skip to content

Instantly share code, notes, and snippets.

@jobel-code
jobel-code / gist_version_uuid_by_date.py
Last active November 30, 2018 14:54
Generates the equivalent of an uuid3 but qualifing only by datetime.utcnow()
from hashlib import md5
from uuid import UUID, uuid4
from datetime import datetime
def version_uuid_by_date()->str:
"""Generates the equivalent of an uuid3 but qualifing only by datetime.utcnow()
example:
'2018-11-15' will return 'f77ef8a9-a377-3083-b131-148cded89c95'
"""
@jobel-code
jobel-code / gist_create_file_lists.py
Last active December 14, 2018 13:53
Different ways to read all files from a directory using python
# Knowing a base `dirpath` retrieve all files starting with `NV` and with file extension `.img`
from glob import glob
onlyfiles = glob( '{}/NV*.img'.format(dirpath))
#
import glob
onlyfiles = glob.glob("/home/adam/*.txt"))
# List recursibly in `dirpath` all the `.tif` files if `mygroup` is in filename and does not include `DEPRECIATED`
onlyfiles = [y for x in os.walk(dirpath) for y in glob(os.path.join(x[0], '*.tif')) if mygroup[:-2] in y and 'DEPRECIATED' not in y]
@jobel-code
jobel-code / database.dart
Created May 6, 2018 08:16 — forked from branflake2267/database.dart
Flutter - Firebase Realtime Database Persistence
import 'dart:async';
import 'package:firebase_database/firebase_database.dart';
import 'package:intl/intl.dart';
class Database {
static Future<String> createMountain() async {
String accountKey = await _getAccountKey();
@jobel-code
jobel-code / bash__install_nodejs_ubuntu.md
Last active June 17, 2019 09:57
How to install node.js 9.x in Ubuntu 16.04