Skip to content

Instantly share code, notes, and snippets.

View sco1's full-sized avatar
๐Ÿ•

S. Co1 sco1

๐Ÿ•
View GitHub Profile

reproducer

$ flake8 --version
4.0.1 (flake8-bonk: 0.1.0, mccabe: 0.6.1, pycodestyle: 2.8.0, pyflakes: 2.4.0) CPython 3.10.2 on Darwin
$ flake8 -vv ./bonk.py
...
flake8.main.application   MainProcess    152 INFO     Finished running
flake8.main.application   MainProcess    152 INFO     Reporting errors
flake8.style_guide        MainProcess    152 DEBUG    Deciding if "BONK001" should be reported
@sco1
sco1 / SO_47289333.m
Last active November 14, 2017 17:33
SO_47289333
A = arrayfun(@(x){randi([1 3],1,randi([1 5]))},1:500);
t1 = timeit(@()test1(A));
t1a = timeit(@()test1_nocf(A));
t2 = timeit(@()test2(A));
t2a = timeit(@()test2_nocf(A));
t3 = timeit(@()test3(A));
t3a = timeit(@()test3_nocf(A));
tmp = ver;
@sco1
sco1 / _SO_42253199
Last active February 15, 2017 16:42
asdf = myobject();
asdf.compute;
asdf.draw;
@sco1
sco1 / SO_41841376
Last active January 25, 2017 17:58
function testcode
C = repmat({'adpo' 2134 []; 0 [] 'daesad'; 'xxxxx' 'dp' 'dpdpd'}, 20);
querystr = 'dp';
t1 = timeit(@()trial1(C, querystr));
t2 = timeit(@()trial2(C, querystr));
t3 = timeit(@()trial3(C, querystr));
t4 = timeit(@()trial4(C, querystr));
t5 = timeit(@()trial5(C, querystr));
t6 = timeit(@()trial6(C, querystr));
@sco1
sco1 / SO_40894003
Last active November 30, 2016 17:41
function testcode()
A = rand(1, 999999);
B = rand(1, 424242);
C = rand(1, 101325);
t1 = timeit(@()naivetrim_delete(A, B, C));
t2 = timeit(@()naivetrim_copy(A, B, C));
t3 = timeit(@()naivetrim_cellfun(A, B, C));
tmp = ver;
function testcode
handles.f = figure;
handles.ledit = uicontrol('Style', 'edit', 'String', '', 'Units', 'Normalized', 'Position', [0.1 0.1 0.2 0.1]);
handles.redit = uicontrol('Style', 'edit', 'String', '', 'Units', 'Normalized', 'Position', [0.4 0.1 0.2 0.1]);
com.mathworks.mwswing.MJUtilities.initJIDE;
% Put calendar to my figure
handles.jPanel = com.jidesoft.combobox.DateChooserPanel;
[handles.hPanel,handles.hContainer] = javacomponent(handles.jPanel,[100,100,200,200], handles.f);
@sco1
sco1 / SO_40245465.m
Last active October 26, 2016 20:17
SO_40245465
function trialcode
ENGSPD_1 = rand(1812890, 1);
Eng_Spd = rand(125000, 1);
Speed = rand(412730, 1);
TIME = rand(412730, 1);
Time = rand(125000, 1);
engine_speed_2 = rand(14060, 1);
time_1 = rand(1812890, 1);
time_2 = rand(14060, 1);
img = imread('ngc6543a.jpg');
corners = rand(20, 3);
corners(:,1) = uint8(size(img, 1) * corners(:,1));
corners(:,2) = uint8(size(img, 2) * corners(:,2));
figure(); hold on;
imshow(img, []);
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
for i = 1:size(corners, 1)
function testcode
x = rand(10^7,1);
t1 = timeit(@()sumtest(x));
t2 = timeit(@()nnztest(x));
t3 = timeit(@()findtest(x));
tmp = ver;
fprintf(['Timing Comparison %s\n' ...
'n_Elements: %u\n\n' ...
function testcode
C = repmat({1, 2, 'string', 4}, 100, 100);
t1 = timeit(@()loopmethod(C))
t2 = timeit(@()cellfunmethod(C))
end
function C = loopmethod(C)
for n = 1:numel(C)
if isnumeric(C{n})