Skip to content

Instantly share code, notes, and snippets.

View Fleaurent's full-sized avatar
🚀
It's not Rocket Science!

Fleaurent

🚀
It's not Rocket Science!
View GitHub Profile
@Fleaurent
Fleaurent / crontab_header.sh
Created September 9, 2023 15:34 — forked from wesleyit/crontab_header.sh
A default crontab header that will make the life easier for those who don't remember cron fields or keywords.
## CRONTAB HINTS AND TIPS
##
##
## Entry Description Equivalent To
## @yearly (or @annually) Run once a year at midnight in the morning of January 1 0 0 1 1 *
## @monthly Run once a month at midnight in the morning of the first of the month 0 0 1 * *
## @weekly Run once a week at midnight in the morning of Sunday 0 0 * * 0
## @daily Run once a day at midnight 0 0 * * *
## @hourly Run once an hour at the beginning of the hour 0 * * * *
## @reboot Run at startup @reboot
@Fleaurent
Fleaurent / json_basics.py
Created July 12, 2021 21:25
JSON Basics
import json
# a) parse json object
# json.load() parse file content
with open(file="json_data.json", mode='r') as file_content:
# print(type(content))
json_obj1 = json.load(file_content)
print(type(json_obj1))
for key, value in json_obj1.items():
@Fleaurent
Fleaurent / docker_permission_denied.sh
Created July 6, 2021 07:46
Docker Permission Denied
$ sudo groupadd docker
$ sudo usermod -aG docker $USER
$ newgrp docker
$ docker run hello-world
@Fleaurent
Fleaurent / Wipe_SD_Card.sh
Last active July 6, 2021 04:47
Wipe SD-Card Raspberry Pi
# clear the partition table on the card, effectively blanking it.
$ diskpart
$ list disk
$ SELECT DISK N
$ clean
@Fleaurent
Fleaurent / jupyter_header.py
Last active July 5, 2021 21:10
Jupyter Notebook Header Cell
# basic imports
import os
from pathlib import Path
# notebook path: __file__ might not be available
# FILE_PATH = Path(__file__).absolute()
FILE_DIR = Path(os.path.abspath(''))
PROJECT_DIR = FILE_DIR.parent # parents[0]
# nice plots
Quantifiers for the preceding character:
a match a one time
a? match a once or none
a* match a zero or more times
a+ match a at least one time
a{3} match a three times
a{2, 4} match a between two and four times
a{3,} match a three or more times
Characters:
import sys
from pathlib import Path
WORKING_DIR = Path.cwd()
# __file__ can be a relative path: resolve it into an absolute path first
FILE_PATH = Path(__file__).absolute()
FILE_DIR = FILE_PATH.parent # .parents[0]
PROJECT_DIR = FILE_PATH.parents[1]
@Fleaurent
Fleaurent / jupyter_multiple_outputs.py
Last active December 20, 2020 12:32
Jupyter Notebook multiple outputs
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
@Fleaurent
Fleaurent / Convert_CSV.ipynb
Created November 25, 2020 11:00
Convert time series data .csv to simple DataFrame to nested data
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.