This file contains 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
from typing import List | |
from datetime import timedelta, datetime | |
import streamlit as st | |
import pandas as pd | |
IGNORE_DESCRIPTIONS = [ | |
"Internal Transfer", | |
"International Transaction Fee", | |
] |
This file contains 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
function gitlab { | |
# Find the branch we're on. | |
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) | |
# Find whether there is an MR open for this branch. | |
# Requires the Gitlab CLI: https://gitlab.com/gitlab-org/cli | |
MR_ID=$(glab mr list --author=@me | grep "← ($BRANCH_NAME" | cut -f1) | |
MR_ID=${MR_ID:1} | |
# Find the git remote URL. |
This file contains 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
function matt { | |
if [[ ! -d "./matt "]]; then | |
echo "No matt folder found." | |
else | |
options=$(ls matt | grep ".*\.sh$" | cut -d. -f1) | |
if [[ -z "$1" ]]; then | |
echo -e "Options:\n\n$options\n" | |
else | |
echo "Running $1" | |
bash ./matt/$1.sh ${@:2} |
This file contains 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
<div id="dynamic-form-{{ form.slug }}"> | |
{% if form.editable %} | |
<form | |
class="ui form {% if form.errors %}error{% else %}success{% endif %}" | |
method="post" | |
hx-post="./{{ form.slug }}/" | |
hx-target="#dynamic-form-{{form.slug}}" | |
hx-swap="outerHTML" | |
> | |
{% for field in form %} |
This file contains 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
from django.forms import ModelForm | |
from django.template.loader import render_to_string | |
from django.shortcuts import render | |
from django.http import Http404 | |
from django.contrib import messages | |
class DynamicTableForm(ModelForm): | |
""" | |
Renders a table which can be optionally edited by a user using htmx. |
This file contains 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
user root; | |
worker_processes 4; | |
pid /run/nginx.pid; | |
events { | |
worker_connections 768; | |
} | |
http { | |
## |
This file contains 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
### Virtual Host Config | |
## HTTP Redirects | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name www.mattslinks.xyz; | |
return 301 http://mattslinks.xyz$request_uri; | |
} | |
server { |
This file contains 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 React, { useState } from 'react' | |
import Header from './components/Header.js' | |
import Game from './components/Game.js' | |
import LeaderBoard from './components/LeaderBoard.js' | |
import Spinner from './components/Spinner.js' | |
// Don't hardcode strings, use constants | |
const DEFAULT_NAME = 'jeff' | |
export default function App(){ |
This file contains 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 React, { useState } from 'react' | |
import Header from './components/Header.js' | |
import Game from './components/Game.js' | |
import LeaderBoard from './components/LeaderBoard.js' | |
import Spinner from './components/Spinner.js' | |
// Don't hardcode strings, use constants | |
const DEFAULT_NAME = 'jeff' | |
export default function App(){ |
This file contains 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
""" | |
Synthesizes speech from the input string of text. | |
from reader.services.translate.polly import text_to_speech_mp3 | |
reading = Reading.objects.last() | |
with open('./test.mp3', 'wb') as f: | |
text_to_speech_mp3(reading, f) | |
""" | |
from io import BytesIO | |
import boto3 |
NewerOlder