This file contains hidden or 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
| def reshape_for_fitting(arr, kernel_half_width=0, kernel_lag=0, pad_kwargs=None): | |
| """Reshape 1D array into a shape suitable for easy convolution/AR model fitting.""" | |
| assert len(arr.shape) == 1, "Array must be 1D" | |
| n = len(arr) | |
| pad_kwargs = pad_kwargs or {} | |
| pad_left = max(kernel_half_width - kernel_lag, 0) | |
| pad_right = max(kernel_half_width + kernel_lag, 0) | |
| arr_padded = np.pad(arr, [(pad_left, pad_right)], **pad_kwargs) | |
| return stride_tricks.as_strided( | |
| arr_padded, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
| kubectl get pods --sort-by=.status.conditions[0].lastTransitionTime |
This file contains hidden or 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
| def cartesian(arrays): | |
| """ | |
| Generate a cartesian product of input arrays. | |
| Parameters | |
| ---------- | |
| arrays : list of array-like | |
| 1-D arrays to form the cartesian product of. | |
| out : ndarray | |
| Array to place the cartesian product in. |
This file contains hidden or 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
| def repeat(df, count_column): | |
| expanded_df = df.loc[ | |
| df.index.repeat(repeats=df[count_column]) | |
| ].reset_index(drop=True) | |
| expanded_df[count_column] = 1 | |
| return expanded_df |
This file contains hidden or 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 tensorflow.python.client import device_lib | |
| def get_available_gpus(): | |
| local_device_protos = device_lib.list_local_devices() | |
| return [x.name for x in local_device_protos if x.device_type == 'GPU'] | |
| get_available_gpus() |
This file contains hidden or 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
| -- Code based on https://github.com/cmderdev/cmder/issues/1056 | |
| -- with modifications to make it work with conda/virtual envs (https://github.com/cmderdev/cmder/issues/1056#issuecomment-237403714) | |
| local clink_path_lua_file = clink.get_env('CMDER_ROOT')..'\\vendor\\clink-completions\\modules\\path.lua' | |
| dofile(clink_path_lua_file) | |
| --- | |
| -- Find out current conda/virtual envs | |
| -- @return {false|conda/virtual env name} | |
| --- |