Skip to content

Instantly share code, notes, and snippets.

View ccaspers's full-sized avatar

Christian Caspers ccaspers

View GitHub Profile
@ccaspers
ccaspers / gist:4b3fadc702fdc2ed8f244210fbef2e39
Created April 21, 2023 14:17
Open Files With Lint Errors in VSCode
npx eslint src -f compact | awk -F ":" '{print $1}' | uniq | head -n -2 | xargs code -r
@ccaspers
ccaspers / 01-venv-tutorial.md
Last active April 27, 2024 04:04
Virtualenv Tutorial

Virtual Environments

A Virtual Environment is a tool to keep the dependencies required by different projects in separate places, by creating virtual Python environments for them. It solves the “Project X depends on version 1.x but, Project Y needs 4.x” dilemma, and keeps your global site-packages directory clean and manageable. - The Hitchhiker’s Guide to Python!

Virtual Environments werden also dazu genutzt um verschiedene Softwareprojekte und ihre Abhängigkeiten voneinander zu isolieren. Ein netter nebeneffekt ist, das Installation aus dem Python Package Index (pip) ohne Administratorrechte erfolgen können, weil die Pakete im Verzeichnis des Virtual Environments installiert werden.

Jedes Virtual Environment hat seine eigenen site-packages sowie pip- und python-Kommandos. Dabei wird der Interpreter nicht jedes neu installiert, sondern über Symlinks verknüpft.

Ein Virtual Environment erzeugen

@ccaspers
ccaspers / mp-events-demo.py
Last active February 5, 2017 14:56
basic multiprocessing with python 3.6. workers can be stopped externally via events.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import multiprocessing as mp
from time import sleep
def task(exit_evt, id):
while not exit_evt.is_set():
pass
@ccaspers
ccaspers / tmux_local_install.sh
Last active July 11, 2016 16:28 — forked from ryin/tmux_local_install.sh
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $APP_DIR/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.2
@ccaspers
ccaspers / sourcesanspro.sh
Last active February 20, 2016 00:25
Texlive install fonts
sudo apt-get install xzdec
tlmgr init-usertree
tlmgr install sourcesanspro
@ccaspers
ccaspers / tmux-cheatsheet.markdown
Created January 23, 2016 15:22 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ccaspers
ccaspers / svncommands.sh
Created January 4, 2016 14:26
SVN Cheatsheet
# revert ALL changes recursively
svn revert -R .
# undo multiple commits
svn merge -c -REV_X,-REV_Y,-REV_Z .
svn commit -m "reverted revisions x, y, z"
@ccaspers
ccaspers / tmux.md
Last active August 29, 2015 14:27 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@ccaspers
ccaspers / openmesh-windows.md
Created June 15, 2015 16:45
Compiling OpenMesh on Windows (Qt and MinGW)

Compiling OpenMesh with mingw and cmake on windows

  • unpack OpenMesh
  • go to OpenMesh folder and create a folder called "build" inside
  • open qt-cmd-prompt as administrator (needed to install)
  • cmake-gui
  • fill in path to source and build-directory
  • click Configure and choose mingw-makefiles
  • click Generate
  • close CMake-Gui and switch back to cmd-prompt
  • navigate to build folder
@ccaspers
ccaspers / pythonnode.sh
Last active August 29, 2015 14:01
python with pip, virtualenv and nodeenv without sudo
#!/bin/bash
# .local/bin zu PATH hinzufügen, automatisch bei öffnen des Terminals
# an ~/.bashrc anhängen
echo "export PATH=\$PATH:~/.local/bin" >> ~/.bashrc
#bashrc neu laden
source ~/.bashrc
# setuptools laden und für user installieren
wget https://bootstrap.pypa.io/ez_setup.py -O - | python - --user
#bashrc neu laden