Skip to content

Instantly share code, notes, and snippets.

View benje's full-sized avatar

Ben Reynhart benje

View GitHub Profile
@codingforentrepreneurs
codingforentrepreneurs / Django for Jupyter.md
Last active May 7, 2024 16:24
Django Setup for use in Jupyter Notebooks

Django for Jupyter

It's true packages exist to make it "easy" to use Django inside of a jupyter notebook. I seem to always run into issues successfully running these packages. I've found the below method useful although I cannot recall how I discovered how this works (aka attribution needed).

Requirements

  • Virtual Environment (virtualenv, venv, pipenv, etc)
  • Django installed & project created (we'll use the project name cfehome)
  • Jupyter installed at least in the virtual environment
@balazs-endresz
balazs-endresz / storage.py
Last active August 20, 2018 22:22
ManifestStaticFilesStorage with source maps, and ignoring missing files
from django.contrib.staticfiles.storage import ManifestStaticFilesStorage
class ManifestStaticFilesStorageWithSourceMaps(ManifestStaticFilesStorage):
"""
Adds js and css source map support for ManifestStaticFilesStorage.
"""
patterns = (
("*.css", (
@rsarai
rsarai / admin.py
Last active June 30, 2022 14:34
How to create a simple confirmation view on Django Admin like the default delete view works
from django import forms
from django.contrib import admin
from django.template.response import TemplateResponse
class RegularCreationAdminForm(forms.ModelForm):
class Meta:
model = ReactivationCoupon
fields = [
"""
Configuration example for ``ptpython``.
Copy this file to ~/.ptpython/config.py
"""
from __future__ import unicode_literals
from prompt_toolkit.filters import ViInsertMode
from prompt_toolkit.key_binding.input_processor import KeyPress
from prompt_toolkit.keys import Keys
from pygments.token import Token
@shihanng
shihanng / .chunkwmrc
Last active January 6, 2024 04:17
chunkwm + skhd
#!/bin/bash
#
# NOTE: specify the absolutepath to the directory to use when
# loading a plugin. '~' expansion is supported.
#
chunkc core::plugin_dir /usr/local/opt/chunkwm/share/chunkwm/plugins
#
<template>
<div id="app">
<p>
Pending: {{ $store.state.getInfoPending }}
</p>
<p>
{{ $store.state.getInfoData }}
</p>
</div>
</template>
@joe-wolfe21
joe-wolfe21 / .tmux.conf
Last active July 9, 2020 10:26
The Ultimate Terminal
# use zsh & make pbcopy/paste work
set-option -g default-terminal /bin/zsh
set-option -g default-command "reattach-to-user-namespace -l zsh"
bind w new-window -c "#{pane_current_path}"
# It's 2016
set -g default-terminal "screen-256color"
# set the command escape time to 0
set -s escape-time 0
@veuncent
veuncent / docker_debugging.md
Last active February 21, 2024 00:58
Debugging Django apps running in Docker using ptvsd - Visual Studio (Code)

Remote debugging in Docker (for Django apps)

In order to enable debugging for your Django app running in a Docker container, follow these steps using Visual Studio (Code):

  1. Add ptvsd to your requirements.txt file
ptvsd == 4.3.2
  1. To your launch.json, add this:
@armand1m
armand1m / Dockerfile
Last active March 10, 2024 14:54
Yarn cache compatible Dockerfile
FROM alpine
RUN apk add --update --no-cache nodejs
RUN npm i -g yarn
ADD package.json yarn.lock /tmp/
ADD .yarn-cache.tgz /
RUN cd /tmp && yarn
RUN mkdir -p /service && cd /service && ln -s /tmp/node_modules
@lucifr
lucifr / init.lua
Last active June 4, 2022 19:21
My Hammerspoon config file
-- -------------------------------
-- Watcher for changes of init.lua
-- -------------------------------
function reloadConfig(files)
doReload = false
for _,file in pairs(files) do
if file:sub(-4) == ".lua" then
doReload = true
end
end