Skip to content

Instantly share code, notes, and snippets.

View purmac's full-sized avatar

purmac purmac

  • Atlanta, GA
View GitHub Profile
@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
@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;
$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 / 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)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
function Counter({value}) {
return <h1>{value}</h1>
}
function Counter2(props) {
return <h1>{props.value}</h1>
}
const render = () => {
ReactDOM.render(<Counter value=1 />, document.getElementById('root'));
@purmac
purmac / tmux.md
Created November 1, 2017 20:01 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@purmac
purmac / tmux_cheatsheet.md
Last active November 5, 2017 22:27 — forked from henrik/tmux_cheatsheet.markdown
tmux cheatsheet

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

% Give the file name
% Open the file and get the file descriptor
filename = "PrintingPath01.txt";
fd = fopen(filename, 'r');
linepattern = "#####\s*Line\s\d+"; % match #### Line {num}
nodepattern = "\s\d+\s"; % match " {num} "
coordpattern = "[-+]?[0-9]*\.?[0-9]+"; % match float number
line_count = 0;
data = {};
@purmac
purmac / saveFilefromChrome.js
Created November 11, 2017 21:34
Save file from google chrome
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'