Skip to content

Instantly share code, notes, and snippets.

View joshp123's full-sized avatar

Josh Palmer joshp123

View GitHub Profile
@joshp123
joshp123 / gist:9449352
Last active August 29, 2015 13:57
diffev and model methods
>>> print([m for m in dir(diffev.DiffEv) if m.startswith('set')])
['set_autosave_func', 'set_autosave_interval', 'set_chunksize', 'set_create_trial', 'set_fitting_ended_func', 'set_fom_allowed_dis', 'set_km', 'set_kr', 'set_max_generation_mult', 'set_max_generations', 'set_max_log', 'set_parameter_output_func', 'set_plot_output_func', 'set_pop_mult', 'set_pop_size', 'set_processes', 'set_sleep_time', 'set_text_output_func', 'set_use_autosave', 'set_use_boundaries', 'set_use_max_generations', 'set_use_parallel_processing', 'set_use_pop_mult', 'set_use_start_guess', 'setup_parallel']
>>> print([m for m in dir(model.Model) if m.startswith('')])
['__doc__', '__init__', '__module__', '_read_from_file', '_reset_module', '_save_to_file', 'calc_fom', 'compile_script', 'create_fit_func', 'eval_in_model', 'evaluate_fit_func', 'evaluate_sim_func', 'export_data', 'export_script', 'export_table', 'get_data', 'get_data_as_asciitable', 'get_filename', 'get_fit_pars', 'get_fit_values', 'get_parameters', 'get_possible_param
@joshp123
joshp123 / 0_reuse_code.js
Last active August 29, 2015 14:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@joshp123
joshp123 / redis-one-line--pattern-delete.sh
Last active July 5, 2017 13:45 — forked from MattSurabian/redis-one-line--pattern-delete.sh
One liner for deleting based on a pattern in redis. KEYS supports wildcards, delete/get/etc doesn't. No worries xargs to the rescue.
redis-cli -h <HOST> -p <PORT> KEYS "<PATTERN>" | xargs -i% redis-cli -h <HOST> -p <PORT> DEL %
#easy mmode:
redis-cli KEYS "<pattern>" | xargs -i% redis-cli GET %
@joshp123
joshp123 / workspace.sh
Created October 2, 2018 16:22
start aws workspace matching given username
aws workspaces describe-workspaces | jq '.Workspaces[] | select(.UserName=="josh").WorkspaceId' | xargs -I % aws workspaces start-workspaces --cli-input-json "$(aws workspaces start-workspaces --generate-cli-skeleton | sed 's/\"\"/\"%\"/')"
@joshp123
joshp123 / gist:c09ee6ed4b3f56a37adee29603c556e8
Last active October 4, 2018 13:28
vim dictionary-ise variables
:%s/\(\zs\S\+\ze\s\{1}[=]\)/config["\1"]/g
(then do this because it's buggy)
%s/ ="/"/g
given a file like so:
foo = {SomeObject(
a=1,
b=2,
c=3
@joshp123
joshp123 / crashy_thread.py
Last active December 12, 2018 16:14
Bare raise inside thread causes segfault
import threading
import time
import logging
logging.basicConfig()
log = logging.Logger(__name__)
class CrashyThread(threading.Thread):
def run(self):
@joshp123
joshp123 / developing_in_containers.sh
Created October 30, 2018 15:13
Developing in containers (bad!!!)
Developing in containers (bad!!!)
wget ftp://ftp.vim.org/pub/vim/unix/vim-8.1.tar.bz2
tar -xjvf vim-8.1.tar.bz2
cd vim81/
make
export PATH=$PWD/src:$PATH
git clone https://github.com/joshp123/dotfiles.git /tmp/dotfiles
cp /tmp/dotfiles/.vimrc ~
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim