Skip to content

Instantly share code, notes, and snippets.

@ashwinvis
ashwinvis / guake_local_install_debian_wheezy.sh
Created March 17, 2016 18:42
Guake local installation without root
#!/bin/bash
# Locally install guake without root privileges
# Tested on a Debian 7 Wheezy machine with Guake v0.4.3-3
#
# (c) 2016 Ashwin Vishnu
LOCALUSR=$HOME/.local
mkdir -p $LOCALUSR
@ashwinvis
ashwinvis / tmux_local_install.sh
Last active September 2, 2016 08:39
Tmux local installation without root
#!/bin/bash
#
# Add the following lines to .bashrc before running the script
#
# export SCRATCH=/scratch/$USER
# export XDG_DATA_DIRS=$XDG_DATA_DIRS:$SCRATCH/.local/share
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SCRATCH/.local/lib
# export PATH=$PATH:$SCRATCH/.local/bin
set -e
@ashwinvis
ashwinvis / install_fftw.sh
Created June 15, 2017 22:38
FFTW local installation
#!/bin/bash
pkgname='fftw'
pkgver=3.3.6-pl2
srcdir=$PWD
pkgdir='$HOME/.local/share/fftw'
download() {
cd ${srcdir}
@ashwinvis
ashwinvis / install_stow.sh
Created June 29, 2017 16:32
CPAN and GNU stow installation
#!/bin/bash
# Set up CPAN
# Append the following lines to .bashrc / .profile
# PERL_DIR=$HOME/.perl
# export PERL_LOCAL_LIB_ROOT=$PERL_DIR:${PERL_LOCAL_LIB_ROOT}
# export PATH=$PERL_DIR/bin:$PATH
# export PERL5LIB=$PERL_DIR/lib/perl5
# PERL_MB_OPT="--install_base \"${PERL_DIR}\""; export PERL_MB_OPT;
# PERL_MM_OPT="INSTALL_BASE=${PERL_DIR}"; export PERL_MM_OPT;
@ashwinvis
ashwinvis / .conda_aliases
Created October 14, 2017 12:28
Use Anaconda's `conda` tool as if you were using `virtualenvwrapper`
alias workon='source activate'
alias deactivate='source deactivate'
alias mkvirtualenv='conda create'
alias lsvirtualenv='conda-env list'
alias rmvirtualenv='conda-env remove'
function cpvirtualenv{
conda create --clone $1 --name $2
}
import curses
import time
stdscr = curses.initscr()
curses.curs_set(1) # visible
time.sleep(2)
curses.curs_set(0) # invisible
time.sleep(2)
curses.curs_set(1) # visible
time.sleep(2)
import curses
from random import randint
# Print random text in a 10x10 grid
stdscr = curses.initscr()
for rows in range(10):
line = ''.join([chr(randint(41, 90)) for i in range(10)])
stdscr.addstr(line + '\n')
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ashwinvis
ashwinvis / backup_venv.sh
Last active May 15, 2023 16:02
Backup virtualenv before a Python 3.x upgrade and restore / recreate after the upgrade
#!/bin/bash
cd ~
pip freeze --user --exclude-editable > REQUIREMENTS.txt
cd $WORKON_HOME # or wherever you store your virtualenvs
for activate in ./*/bin/activate
do
source $activate
echo $VIRTUAL_ENV
@ashwinvis
ashwinvis / Interpolation.ipynb
Last active August 10, 2018 15:44
Unstructured 2D data algorithms in scipy.interpolate: results and performance
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.