import time
import functools
def timer(func):
"""Print the runtime of the decorated function"""
@functools.wraps(func)
def wrapper_timer(*args, **kwargs):
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$outputPath = "D:\dev\fuelprices\history\" | |
# by default get all prices for all days of the year up until yesterday | |
$startDate = Get-Date "2022-01-01" | |
$endDate = (Get-Date).AddDays(-1) | |
for ( $currentDate = $startDate; $currentDate -lt $endDate; $currentDate = $currentDate.AddDays(1) ) { | |
$year = $currentDate.Year | |
$month = $currentDate.Month.ToString("00") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://stackoverflow.com/a/62859169/562769 | |
import argparse | |
from pathlib import Path | |
from typing import List, Tuple | |
import fitz # install with 'pip install pymupdf' | |
def _parse_highlight( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
import csv | |
from datetime import datetime, timedelta | |
import requests | |
from dateutil.parser import parse | |
start_date: str = "2009-01-01" | |
end_date: str = datetime.now().strftime("%Y-%m-%d") | |
currencies: str = "USD,RON" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/usr/bin/env python3 | |
import configparser | |
import subprocess | |
def main() -> int: | |
cfg = configparser.RawConfigParser() | |
cfg.read('setup.cfg') | |
current_version = cfg['metadata']['version'] | |
prev = subprocess.check_output(('git', 'show', 'HEAD:setup.cfg')).decode() | |
cfg.read_string(prev) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[tox] | |
envlist = py37,py38 | |
skipsdist = True | |
[testenv] | |
deps = | |
-r requirements.txt | |
commands = | |
pytest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I'd just like to interject for a moment. What youโre referring to as Linux, is in fact, GNU/Linux, or as Iโve recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX. Many computer users run a modified version of the GNU system every day, without realizing it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import psutil | |
from datetime import datetime | |
import os.path | |
import csv | |
FILE_NAME = "cpu_temps.csv" | |
FILE_EXISTS = os.path.isfile(FILE_NAME) | |
HEADER = ["DATE", "SENSOR1", "SENSOR2", "SENSOR3", "SENSOR4"] | |
MINUTES_INTERVAL = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
DIR=/home/pgross/workspace_java/ITTRouting/ | |
SESSION_NAME='itt' | |
BASECMD='java -Xmx42G -jar ITTRouting.jar' | |
# SCRIPT-START | |
cd ${DIR} | |
# create the session and window 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
MQTT part based on: http://www.steves-internet-guide.com/into-mqtt-python-client/ | |
API docs for HSL high-frequency positioning: https://digitransit.fi/en/developers/apis/4-realtime-api/vehicle-positions/ | |
@adapted from https://gist.github.com/tjukanovt/ce8f84026db01582fbc23bfd67d56f8b | |
@requirements pip install pytz paho-mqtt | |
""" | |
import csv | |
import datetime |
NewerOlder