import inspect | |
import ast | |
def _args_from_usage_string_ast(s): | |
tree = ast.parse(s) | |
ast_args = tree.body[0].value.args | |
args = [s[arg.col_offset:arg.end_col_offset] for arg in ast_args] | |
return args | |
Now available here: https://github.com/y0ast/pytorch-snippets/tree/main/fast_mnist
"""Sampling parameters of a lorenz attractor. | |
The forward pass integrates the lorenz attractor ODE system using | |
tt.scan with a Runge-Kutta integrator. The predicted high-resolution | |
timecourse is interpolated down so it can be compared to low-density | |
observations. | |
""" | |
import abc | |
import numpy | |
import pymc3 |
# Example Huffman coding implementation | |
# Distributions are represented as dictionaries of { 'symbol': probability } | |
# Codes are dictionaries too: { 'symbol': 'codeword' } | |
def huffman(p): | |
'''Return a Huffman code for an ensemble with distribution p.''' | |
assert(sum(p.values()) == 1.0) # Ensure probabilities sum to 1 | |
# Base case of only two symbols, assign 0 or 1 arbitrarily | |
if(len(p) == 2): |
When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.
This is enabled by adding the
ForwardAgent yes
option to any of your Host
entries in ~/.ssh/config
(or alternatively with the -A
option). Don't set this option in a wildcard Host *
section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.
I recently had the following problem:
- From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
- That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.
We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like
ssh -L 3306:localhost:3306 remotehost
# 0 is too far from ` ;) | |
set -g base-index 1 | |
# Automatically set window title | |
set-window-option -g automatic-rename on | |
set-option -g set-titles on | |
#set -g default-terminal screen-256color | |
set -g status-keys vi | |
set -g history-limit 10000 |