Skip to content

Instantly share code, notes, and snippets.

View cknoll's full-sized avatar

C. Knoll cknoll

  • Faculty of Electrical and Computer Engineering, Dresden University of Technology
  • Dresden, Saxony, Germany, EU, Earth, Universe
View GitHub Profile
@welbornprod
welbornprod / Embedded Python in BASH
Created August 14, 2014 23:22
A little trick to embed python code in a BASH script.
#!/bin/bash
# Here are some embedded Python examples using Python3.
# They are put into functions for separation and clarity.
# Simple usage, only using python to print the date.
# This is not really a good example, because the `date`
# command works just as well.
function date_time {
@garystafford
garystafford / helpful-docker-commands.sh
Last active July 1, 2024 06:57
My list of helpful docker commands
###############################################################################
# Helpful Docker commands and code snippets
###############################################################################
### CONTAINERS ###
docker stop $(docker ps -a -q) #stop ALL containers
docker rm -f $(docker ps -a -q) # remove ALL containers
docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter
# exec into container
@richardotis
richardotis / autograd_utils.py
Created November 5, 2015 16:30
Integrating SymPy with autograd for efficient automatic differentiation of lambdify'd functions
"""
This module manages interactions with the autograd library.
"""
import autograd.numpy as anp
import numpy as np
from autograd import elementwise_grad, jacobian
from sympy import lambdify
# NumPyPrinter requires unreleased sympy 0.7.7 (in sympy master)
# if you aren't using Piecewise or logical operators
# you can change NumPyPrinter to LambdaPrinter in this module
@c00kiemon5ter
c00kiemon5ter / create-superuser.py
Created June 16, 2017 11:31
Extend Django's management createsuperuser command to allow non-interactive creation of a superuser with a password.
"""
Extend createsuperuser command to allow non-interactive creation of a
superuser with a password.
Instructions:
mkdir -p path-to-your-app/management/commands/
touch path-to-your-app/management/__init__.py
touch path-to-your-app/management/commands/__init__.py