interact -q p100_normal_q -l procs=2,gpus=1 -l walltime=20:00:00
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Source: https://bitbucket.org/eigen/eigen/raw/default/debug/gdb/printers.py | |
# https://stackoverflow.com/a/25088214/3138875 | |
# This file is part of Eigen, a lightweight C++ template library | |
# for linear algebra. | |
# | |
# Copyright (C) 2009 Benjamin Schindler <bschindler@inf.ethz.ch> | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from matplotlib.backends.backend_pdf import PdfPages | |
def multipage(filename, figs=None, dpi=200): | |
pp = PdfPages(filename) | |
if figs is None: | |
figs = [plt.figure(n) for n in plt.get_fignums()] | |
for fig in figs: | |
try: | |
fig.savefig(pp, format='pdf') | |
except: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/local/bin/python3.6 | |
""" | |
3-D spline interpolation | |
(with graph drawing by matplotlib) | |
""" | |
import matplotlib.pyplot as plt | |
import sys | |
import traceback | |
class SplineInterpolation: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These commands are based on a askubuntu answer http://askubuntu.com/a/581497 | |
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below. | |
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING. | |
ABSOLUTELY NO WARRANTY. | |
If you are still reading let's carry on with the code. | |
sudo apt-get update && \ | |
sudo apt-get install build-essential software-properties-common -y && \ | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib | |
matplotlib.use('webagg') | |
import numpy as np | |
from scipy.special import binom | |
import matplotlib.pyplot as plt | |
from matplotlib.lines import Line2D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://askubuntu.com/questions/574208/deactivate-caps-lock-in-14-04 | |
# Add this to startup | |
xmodmap -e "keycode 66 = Shift_L NoSymbol Shift_L" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How does the tmux color palette work? | |
# https://superuser.com/a/285400/916053 | |
for i in {0..255}; do | |
printf "\x1b[38;5;${i}mcolour${i}\x1b[0m\n" | |
done | |
# Then use colourxxx with tmux. | |
# Mind the 'u' in colour! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% https://stats.stackexchange.com/a/394487/204863 | |
clear; close all; | |
num_points = 100; | |
xrange = [-100, 100]; | |
x = xrange(1) + 2 * xrange(2) * rand(num_points, 1); | |
yrange = [0, 20]; | |
y = yrange(1) + 2 * yrange(2) * rand(num_points, 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Source: https://stackoverflow.com/questions/8401777/simple-glob-in-c-on-unix-system | |
*/ | |
#include <glob.h> // glob(), globfree() | |
#include <string.h> // memset() | |
#include <vector> | |
#include <stdexcept> | |
#include <string> | |
#include <sstream> |
NewerOlder