Skip to content

Instantly share code, notes, and snippets.

View purmac's full-sized avatar

purmac purmac

  • Atlanta, GA
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@purmac
purmac / loop_index.py
Last active June 23, 2017 07:24
Python Get Index of For Loop
for i, item in enumerate(items):
# enumerate(items) = [(0, item1), (1, item2), ...)
print(i, item)
$input_path = 'C:\Users\Scott\Desktop\fund.txt'
$output_file = ‘C:\Users\Scott\Desktop\extracted_addresses.txt’
$regex = ‘(\$([0-9]{0,3}(,|\.?))+(M|k|[0-9]))’
select-string -Path $input_path -Pattern $regex -AllMatches | % { $_.Matches } | % { $_.Value } > $output_file
@purmac
purmac / gist:5408503
Last active December 16, 2015 08:49
Brute Force TSP for 9 nodes
l = 'abcdefgho';
P = perms([1 2 3 4 5 6 7 8 9]);
P = P(P(:,1)==9,:);
index_x = 1:9;
index_y = mod(index_x,9)+1;
cost_table = zeros(size(P,1),1);
sym_cost = TSP;
for i=1:size(P,1)
cost = 0;
@purmac
purmac / Mail2Task.vb
Last active October 27, 2017 23:00
Send Mail item with mail content attached to Tasks in Outlook. Create the task date as mail receiving date.
Private Sub Application_ItemContextMenuDisplay( _
ByVal CommandBar As Office.CommandBar, _
ByVal Selection As Selection)
Dim objButton As CommandBarButton
On Error GoTo ErrRoutine
If Selection.Count <> 0 Then
If Selection.Item(1).Class = olMail Then