Skip to content

Instantly share code, notes, and snippets.

View DanSearle's full-sized avatar

Daniel Searle DanSearle

View GitHub Profile
@DanSearle
DanSearle / gist:6707491
Created September 25, 2013 23:11
Convert Virtualbox .ova Image to .ovf
The .ova file format is a tar file with a .ovf file inside.
tar xvf virtualboximage.ova
@DanSearle
DanSearle / gist:6765506
Created September 30, 2013 15:29
Convert a vector to a array pointer in c++
std::vector<double> v;
double* a = &v[0];
// From http://stackoverflow.com/a/2923290/1260257
@DanSearle
DanSearle / gist:6807908
Created October 3, 2013 10:29
Download a web page and all linked content, rewriting any links for offline viewing.
wget --mirror -p --convert-links -P <destdir> <URL>
@DanSearle
DanSearle / gist:6807933
Created October 3, 2013 10:49
Download a web page and all linked content, rewriting any links for offline viewing.
wget --mirror -p --convert-links -P <destdir> <URL>
@DanSearle
DanSearle / gist:6812394
Created October 3, 2013 16:09
C++ convert an integer to an enum
int i = 0;
EnumType t = static_cast<EnumType>(i);
@DanSearle
DanSearle / gist:6824595
Last active December 24, 2015 15:59
Generate const C++ getters for fields
cat fields.txt | awk 'sub(";","",$2){print "const",$1,"Get"substr(toupper($2), 1,1)substr($2,2)"()","const","{ return",$2"; }"}'
E.g. fields.txt contains:
std::string test;
bool jaunTwoThree;
Note this command will remove semicolons
@DanSearle
DanSearle / gist:7023487
Created October 17, 2013 11:46
IsEnabled binding of a user control
Instead of modifying a binding in some way (for example you can make it dependent on other control name as it is proposed in other answer) I would move separate the control which will be disabled and control where DataContext will be changed. For example:
<ContentControl IsEnabled="{Binding CanModify}" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2">
<localControls:TeamEmployeeSelector DataContext="{Binding Confidentiality}"/>
</ContentControl>
From http://stackoverflow.com/a/5444979/1260257
@DanSearle
DanSearle / gist:7168268
Created October 26, 2013 11:17
Start puppet master in the foreground for debugging apache/passenger issues with puppet master
puppet master --no-daemonize --debug
@DanSearle
DanSearle / gist:7316236
Created November 5, 2013 09:23
Hidden Trick to Close Windows Explorer in Windows 7 or Vista
Open the Start menu and then hold down the Ctrl and Shift keys at the same time. Right-click on an empty area of the menu, and you’ll see a new option called “Exit Explorer”
From -> http://www.howtogeek.com/howto/windows-vista/hidden-trick-to-close-windows-explorer-in-vista/
Explorer needs to be restarted from the task manager. Get to the task manager with CTRL+SHIFT+ESC
@DanSearle
DanSearle / gist:b780d9ea45fe6fd24432
Created December 11, 2013 23:08
Add magento extension via command line
./mage mage-setup
./mage -V
./mage list-channels
./mage install connect20.magentocommerce.com/community/
e.g. ./mage install connect20.magentocommerce.com/community/ IG_LightBox