Skip to content

Instantly share code, notes, and snippets.

View NobayeneSehloho's full-sized avatar
🐢

Nobelium-Chloride NobayeneSehloho

🐢
  • 00:42 (UTC +02:00)
View GitHub Profile
@NobayeneSehloho
NobayeneSehloho / mass-change-file-name.py
Created February 25, 2021 09:28 — forked from DBoyara/mass-change-file-name.py
Changing the names of files and directories in the specified directory
import os
def main(my_path: str, replace_name: str):
for dirpath, dirnames, filenames in os.walk(my_path):
for dirname in dirnames:
dir_old_name = os.path.join(dirpath, dirname)
if dir_old_name.find(replace_name) != -1:
@NobayeneSehloho
NobayeneSehloho / flask_cache_redis.py
Created February 25, 2021 09:20 — forked from ruanbekker/flask_cache_redis.py
Flask-Cache Example with Redis
from flask import Flask
from flask_caching import Cache
import random
app = Flask(__name__)
cache = Cache(app, config={'CACHE_TYPE': 'redis', 'CACHE_REDIS_URL': 'redis://localhost:6379/0'})
@app.route("/route1")
@cache.cached(timeout=10)
def route1():