Skip to content

Instantly share code, notes, and snippets.

@pirhoo
pirhoo / clean_duplicate_folders.py
Last active September 19, 2024 21:11
Python script that will help you clean up duplicate folders with names like foldername, foldername (1), foldername (2), etc. The script scans the specified directory, groups folders with the same base name, and presents a summary of operations before asking you to confirm actions for each group.
#!/usr/bin/env python3
import os
import re
import argparse
import shutil
import logging
from logging import handlers
from datetime import datetime
from pathlib import Path
@pirhoo
pirhoo / archive.py
Last active August 27, 2024 15:41
A simple python script to extract all archives in the current directory.
#!/usr/bin/env python3
import os
import shutil
import argparse
import subprocess
from pathlib import Path
import multiprocessing
import logging
from logging import handlers
[
{
"name": "Palais des Sports",
"category": "Palais omnisports",
"address": "81, Rue Raymond Teisseire",
"post_code": 13009,
"city": "Marseille",
"phone_number": "04 91 71 30 40",
"url": "http://sports-loisirs.marseille.fr/equipements-sportifs/palais-des-sports",
"longitude": 5.40128867653098,
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pirhoo
pirhoo / main.js
Created August 2, 2021 10:29
Export a Fitbit dump (exercise-*.json files) to Strava
// yarn add strava-v3 glob-promise glob lodash
const strava = require('strava-v3');
const glob = require("glob-promise")
const _ = require("lodash")
strava.config({
client_id: "",
client_secret: "",
redirect_uri: "http://localhost/callback",
})
[
{
"date": "1995",
"value": 284.1733871
},
{
"date": "1996",
"value": 262.2768595
},
{
[
{
"date":2008,
"death":0,
"injury":300,
"malfunction":49
},
{
"date":2009,
"death":2,
[
{
"date": 2008,
"value": 371
},
{
"date": 2009,
"value": 187
},
{
[
{
"label": "Warned about local complications",
"value": 52
},
{
"label": "Not warned",
"value": 42
},
{
[
{
"movie": "Avatar",
"budget": 237,
"box_office": 2784
},
{
"movie": "ET: The Extra-Terrestrial",
"budget": 11,
"box_office": 793