Skip to content

Instantly share code, notes, and snippets.

@nudomarinero
nudomarinero / bash_anaconda
Created February 12, 2015 11:40
Functions in bash to activate or deactivate Anaconda. They can be added to the bashrc file and allow to go back quickly to the system Python if needed.
## Anaconda
# Based on http://stackoverflow.com/questions/370047/what-is-the-most-elegant-way-to-remove-a-path-from-the-path-variable-in-bash#370255
anaconda () {
path=$(IFS=':';t=($PATH);n=${#t[*]};a=();for ((i=0;i<n;i++)); do p="${t[i]%%*anaconda*}"; [ "${p}" ] && a[i]="${p}"; done;echo "${a[*]}");
export PATH=~/anaconda/bin:$path
}
noanaconda () {
path=$(IFS=':';t=($PATH);n=${#t[*]};a=();for ((i=0;i<n;i++)); do p="${t[i]%%*anaconda*}"; [ "${p}" ] && a[i]="${p}"; done;echo "${a[*]}");
export PATH=$path
@nudomarinero
nudomarinero / toggle.py
Last active August 29, 2015 14:15
Toggle on and off the touch screen in a Dell XPS 13 with Linux
#!/usr/bin/env python
from __future__ import print_function
from subprocess import check_output, check_call
device_name = "Synaptics Large Touch Screen"
def get_device_number():
"""
Get the device number of the device using xinput.