Skip to content

Instantly share code, notes, and snippets.

View brettkromkamp's full-sized avatar
🤔
Building stuff

Brett Alistair Kromkamp brettkromkamp

🤔
Building stuff
View GitHub Profile
@brettkromkamp
brettkromkamp / launch.json
Created May 1, 2024 15:43
Visual Studio Code FastAPI launch configuration
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: FastAPI",
"type": "debugpy",
"request": "launch",
"module": "uvicorn",
"args": [
"backend.src.contextualise.main:app",
@brettkromkamp
brettkromkamp / settings.json
Last active May 6, 2024 17:58
Visual Studio Code user settings
{
"editor.fontSize": 20,
"workbench.colorTheme": "Solarized Dark",
"editor.fontLigatures": true,
"editor.fontFamily": "'Fira Code', 'Droid Sans Mono', 'monospace', monospace",
"editor.formatOnSave": true,
"workbench.tree.indent": 16,
"workbench.tree.renderIndentGuides": "always",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
@brettkromkamp
brettkromkamp / .tmux.conf
Last active March 18, 2024 19:18
Tmux configuration
unbind r
bind r source-file ~/.tmux.conf
setw -g mode-keys vi
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# Plugins
@brettkromkamp
brettkromkamp / cube.py
Created December 2, 2023 09:51
Distribute objects in a cube with Blender Python
import bpy
offset = 3
size = 10
for x in range(size):
for y in range(size):
for z in range(size):
bpy.ops.mesh.primitive_cube_add(location=(x * offset, y * offset, z * offset))
@brettkromkamp
brettkromkamp / circle.py
Last active December 4, 2023 10:10
Distribute objects in a circle with Blender Python
import bpy
from math import radians, sin, cos
z = 0.5
theta = radians(360) # 2 PI
columns = 60
alpha = theta / columns
# The radius of a circle is the distance from the center of the circle to any point on it's
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
pip install --upgrade nltk
python -m nltk.downloader all
ptipython
Python 3.9.5 (default, May 4 2021, 03:33:11)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.25.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from nltk.corpus import wordnet as wn
@brettkromkamp
brettkromkamp / pycharm-run-debug-configuration.txt
Created April 25, 2020 08:07
Setting up PyCharm to run and debug Flask applications (specifically, Contextualise)
Debug Flask App
===============
Script path: /home/brettk/Source/knowledge-management/contextualise/contextualise/__init__.py
Environment variables: PYTHONUNBUFFERED=1;FLASK_APP=contextualise;FLASK_ENV=development
Python interpreter: Python 3.8
Working directory: /home/brettk/Source/knowledge-management/contextualise/contextualise
Run Flask App
=============
Script path: /home/brettk/.pyenv/versions/default-2/bin/flask
[DATABASE]
Username = databaseuser
Password = password
Database = databasename
Host = localhost
Port = 5432
@brettkromkamp
brettkromkamp / pypi-upload.txt
Created March 5, 2017 17:42
PyPI Upload Package (+ Statistics)
python setup.py sdist bdist_wheel
twine register dist/topic-db-X.Y.Z.tar.gz
twine register dist/topic_db-X.Y.Z-py3-none-any.whl
twine upload dist/*
https://pypi.python.org/pypi/topic-db/X.Y.Z/json