Skip to content

Instantly share code, notes, and snippets.

View mducle's full-sized avatar

Duc Le mducle

View GitHub Profile
>> aa = rand(1000); [usr, sys] = memory; usr.MemUsedMATLAB
ans =
2900811776
>> bb = aa; [usr, sys] = memory; usr.MemUsedMATLAB
ans =
@mducle
mducle / vagrant_error_debug
Last active April 5, 2021 19:48
Error creating linux OpenStack instance with Vagrant 2.2.15
user@host:~/vagrant$ vagrant up linux
2021-04-05 19:36 | INFO | Authenticating on Keystone
2021-04-05 19:36 | INFO | Authentication on project with user username
2021-04-05 19:36 | DEBUG | request => method : POST
2021-04-05 19:36 | DEBUG | request => url : https://<openstackserver>:5000/v3/auth/tokens
2021-04-05 19:36 | DEBUG | request => headers : {:content_type=>:json, :accept=>:json}
2021-04-05 19:36 | DEBUG | request => body : {"auth":{"identity":{"methods":["password"],"password":{"user":{"name":"username","domain":{"name":"domain"},"password":"****"}}},"scope":{"project":{"name":"project","domain":{"name":"default"}}}}}
2021-04-05 19:36 | DEBUG | response => code : 201
2021-04-05 19:36 | DEBUG | response => headers : {:date=>"Mon, 05 Apr 2021 19:36:18 GMT", :server=>"Apache/2.4.6 (Scientific Linux) OpenSSL/1.0.2k-fips mod_wsgi/3.4 Python/2.7.5", :x_subject_token=>"gAAAAABga2ayj-ceA6Q-s8JG18nIIZSdyw6Xd0hQIvIVS_BlrSQjvh9JXD9bXE7ut2N_7iPJ73By1O75Sc7S68Hp7gVyOiYb43wG7Y1pR7ATN_bBTsNpqSA6ao
@mducle
mducle / gist:152a463fe49319215bc607d74e4b34d3
Created May 6, 2021 14:39
FindPython3 example output
-- The C compiler identification is GNU 8.3.1
-- The CXX compiler identification is GNU 8.3.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/rh/devtoolset-8/root/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/rh/devtoolset-8/root/usr/bin/c++ - skipped
@mducle
mducle / marireduction_output.txt
Created May 17, 2021 15:58
MARI Reduction error message
# mantidpythonnightly reduce_mari.py >& marireduction_output.txt
FrameworkManager-[Notice] Welcome to Mantid 6.0.20210514.1256
FrameworkManager-[Notice] Please cite: http://dx.doi.org/10.1016/j.nima.2014.07.029 and this release: http://dx.doi.org/10.5286/Software/Mantid
DownloadInstrument-[Notice] All instrument definitions up to date
LoadEmptyInstrument-[Notice] LoadEmptyInstrument started
LoadEmptyInstrument-[Notice] LoadEmptyInstrument successful, Duration 0.02 seconds
Load-[Notice] Load started
Load-[Notice] Load successful, Duration 2.99 seconds
Load-[Notice] Load started
Load-[Notice] Load successful, Duration 0.81 seconds
@mducle
mducle / mcphase_sqw.m
Last active November 3, 2021 15:59
Matlab script to convert calculate a spectrum using McPhase from a SpinW object
function spec = mcphase_sqw(h,k,l,i,o,nmf)
% Function to calculate the dispersion relation using McPhase from a SpinW model
%
% NB. Before using, you should set the McPhase path in a global variable, e.g.:
% >> global mcphasedir; mcphasedir = 'D:\mcphase\';
%
% If this is not set, the function assumes all McPhase programs are in the current
% directory - this functions needs the programs "mcphasit", "mcdispit", "spins".
%
% Syntax: [w,s] = mcphase_sqw(h,k,l,o)
@mducle
mducle / docify_help.diff
Created January 6, 2022 15:40
Diff of changes to docify without docstring removals
diff --git a/herbert_core/applications/docify/doc.m b/herbert_core/applications/docify/doc.m
new file mode 100644
index 00000000..40192c0b
--- /dev/null
+++ b/herbert_core/applications/docify/doc.m
@@ -0,0 +1,61 @@
+function doc(varargin)
+ % Customized overloaded doc function
+ % 1. If the topic has docify directives, run docify and use its result
+ % 2. Otherwise use the builtin doc
diff --git a/+euphonic/CoherentCrystal.m b/+euphonic/CoherentCrystal.m
index aebc44d..d39d186 100644
--- a/+euphonic/CoherentCrystal.m
+++ b/+euphonic/CoherentCrystal.m
@@ -11,6 +11,9 @@ classdef CoherentCrystal < light_python_wrapper.light_python_wrapper
is_initialised = euphonic_on();
is_redirected = light_python_wrapper.light_python_wrapper.redirect_python_warnings();
end
+ properties (Constant)
+ horace_disp = horace_disp_private();
# #!/bin/bash
#
# git diff v3.5.3 v3.6.0 > v_353_360.diff
# paste <(grep "^---" v_353_360.diff) <(grep "^+++" v_353_360.diff )| grep "+++ /dev/null"| sed "s/+++ \/dev\/null//" | sed "s/--- a\///"|sort > v_353_360.removed
# paste <(grep "^---" v_353_360.diff) <(grep "^+++" v_353_360.diff )| grep "\-\-\- /dev/null"| sed "s/--- \/dev\/null//" | sed "s/+++ b\///"|sort > v_353_360.added
# for ff in $(cat v_353_360.removed)
# do
# frag2=$(basename `dirname $ff`)/$(basename $ff)
# ispresent=$(grep $frag2 v_353_360.added)
# if [ -z "$ispresent" ]
# #!/bin/bash
# git diff v3.5.3 v3.6.0 > v_353_360.diff
# paste <(grep "^---" v_353_360.diff) <(grep "^+++" v_353_360.diff )| grep "+++ /dev/null"| sed "s/+++ \/dev\/null//" | sed "s/--- a\///"|sort > v_353_360.removed
# paste <(grep "^---" v_353_360.diff) <(grep "^+++" v_353_360.diff )| grep "\-\-\- /dev/null"| sed "s/--- \/dev\/null//" | sed "s/+++ b\///"|sort > v_353_360.added
# for ff in $(cat v_353_360.removed)
# do
# ispresent=$(grep `basename $ff` v_353_360.added)
# if [ -z "$ispresent" ]
# then
# echo $ff
@mducle
mducle / unique_con.m
Created March 22, 2022 12:05
Heterogenous matlab container storing only unique objects and indexing to these
classdef unique_con < handle
properties(Access=private)
store_ = {};
hash_ = [];
idx_ = [];
end
methods
function obj = unique_con(varargin)
if numel(varargin) == 1 && iscell(varargin{1})
varargin = varargin{1};