Skip to content

Instantly share code, notes, and snippets.

View iskyd's full-sized avatar

Mattia Careddu iskyd

View GitHub Profile
@Julian-Nash
Julian-Nash / flask_sitemap_generator.py
Last active May 4, 2024 13:03
Flask dynamic sitemap generator
@app.route("/sitemap")
@app.route("/sitemap/")
@app.route("/sitemap.xml")
def sitemap():
"""
Route to dynamically generate a sitemap of your website/application.
lastmod and priority tags omitted on static pages.
lastmod included on dynamic content such as blog posts.
"""
from flask import make_response, request, render_template
@jojonki
jojonki / FrozenLake-V0-QLearning.py
Last active May 19, 2022 17:47
FrozenLake-v0 with Q learning
# -*- coding: utf-8 -*-
# ref: https://gym.openai.com/evaluations/eval_1lfzNKEHS9GA7nNWE73w
import numpy as np
import gym
from gym import wrappers
# Q learning params
ALPHA = 0.1 # learning rate
GAMMA = 0.99 # reward discount
@mandiwise
mandiwise / Count lines in Git repo
Last active May 16, 2024 13:28
A command to calculate lines of code in all tracked files in a Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l