Skip to content

Instantly share code, notes, and snippets.

View jacobvalenta's full-sized avatar

Jacob Valenta jacobvalenta

  • Kentucky
View GitHub Profile
from django import forms
from django.http import HttpResponseForbidden
from employees.models import Employee
class PinForm(forms.Form):
number = forms.CharField(max_length=4)
pin = forms.CharField(max_length=4)
def check_authentication(self):
class CustomerSearchView(DatatableView):
template_name = "customers/search.html"
datatable_options = {
'columns': [
("Customer Number", 'number'),
("Name", ['first_name', 'last_name']),
"Address",
"Quick Menu",
"View Customer",
]
@jacobvalenta
jacobvalenta / eastern_mantras.txt
Created October 8, 2021 05:09
Short list of mantras for meditation.
Om
Om Mani Padme Hum
Om Ganesha
Om Gajānanāya Namaha
Om Gam Ganapataya Namaha
Om Namah Shivaya
Om Shivaya Namaha
Om Ram Ramaya Swaha
Om Sri Ramaya Namaha
Om Sri Matre Namaha
How large is Python Source Code?
How many MB is Python?
The source code downloaded from github, (version 3.8.0b4) is 93.9 MB
https://github.com/python/cpython/tree/v3.8.0b4

Django developement media url misconfiguration

Error:

Your URL pattern [<URLPattern '^media/(?P<path>.*)$'>] is invalid. Ensure that urlpatterns is a list of path() and/or re_path() instances.

Explaination

static() returns a list of url paths, (not a url path).

Python get text between brackets

Sample Text

This text is [split up] into sections. the [deliminating character] is the [square bracket].
[[groups may be nested] within [one another]].

Code

@jacobvalenta
jacobvalenta / wav-to-mp3.md
Last active March 27, 2023 18:45
Convert all .wavs in folder to mp3

Convert all .wav files to .mp3

for i in *.wav; do ffmpeg -i "$i" -vn -ar 44100 -ac 2 -b:a 192k "${i%.*}.mp3"; done
  • I don't have time to look up -vn, -ar, -ac or -b:a.
  • 44100 is fine for almost all cases.
  • Use common quality values like [64k, 128k, 192k, 256k, 320k]

@jacobvalenta
jacobvalenta / bible.txt
Last active June 1, 2023 13:24
The bible but it rhymes.
In the beginning god created
The Heaven and the Earth, elated.
Earth was there, but void, no pith;
No form to hold or comfort with.
Around without, was darken'd trace,
Across the deep wet water's face.
Eyes, without a seeing face performed,
The Spirit 'cross the waters warmed.