Skip to content

Instantly share code, notes, and snippets.

View RazerM's full-sized avatar

Frazer McLean RazerM

View GitHub Profile
@RazerM
RazerM / Virtual Box Host Only Static IP.md
Created October 12, 2015 09:44 — forked from pjdietz/Virtual Box Host Only Static IP.md
VirtualBox Host-Only Adapter with Static IP

VirtualBox Host-Only Static IP

My typical setup for a development box in VirtualBox uses two NICs. The first uses NAT to allow the box to communicate with the outside world through my host computer’s network connection. (NAT is the default, so shouldn't require any setup.) The second is a "host-only" connection that allows my host and guest to interact.

To create a host-only connection in VirtualBox, start by opening the preferences in VirtualBox. Go to the "Network" tab, and addd a Host-only Network. Modify the host-only network, and disable DHCP. Make a note of the IP address. (Feel free to set the IP address as well, if you like.)

Next, assign this host-only adapter to the virtual machine. Select the VM and press "Settings". Go to the "Network" tab, and select "Adpater 2". Enable the adapter, set it to a "Host-only Adapter", and select the adpater you created above.

Temporary

Keybase proof

I hereby claim:

  • I am razerm on github.
  • I am razerm (https://keybase.io/razerm) on keybase.
  • I have a public key whose fingerprint is B1E2 1C5B B9F8 073E A5EF 7FB7 A39D 7E9B F17F 6F5F

To claim this, I am signing this object:

# Include the Dropbox SDK libraries
from dropbox import client, rest, session
# Get your app key and secret from the Dropbox developer website
APP_KEY = 'INSERT_APP_KEY_HERE'
APP_SECRET = 'INSERT_SECRET_HERE'
# ACCESS_TYPE should be 'dropbox' or 'app_folder' as configured for your app
ACCESS_TYPE = 'INSERT_ACCESS_TYPE_HERE'
@RazerM
RazerM / gist:7893559
Last active December 30, 2015 22:19 — forked from ctaloi/gist:4156185
import webbrowser, os, pprint
# Include the Dropbox SDK libraries
#from dropbox import client, rest, session
import dropbox
# Configuration
TOKEN_FILENAME = 'PythonistaDropbox.token'
# Get your app key and secret from the Dropbox developer website
APP_KEY = '<your dropbox app_key>'
APP_SECRET = '<your dropbox app_secret>'
Invocation: ./configure --prefix-dir=/usr/local/Cellar/openttd/1.3.0
Detecing awk...
Trying: echo "a.c b.c c.c" | tr ' ' \n | awk ' { ORS = " " } /\.c$/ { gsub(".c$", ".o", $0); print $0; }' 2>/dev/null
Result: 'a.o b.o c.o '
checking awk... awk
detecting OS... OSX
executing cc -dumpmachine
returned x86_64-apple-darwin13.0.0
exit code 0
@RazerM
RazerM / gist:5344942
Created April 9, 2013 11:22
LaTeX: Align long equations #snippet
\begin{align}
A &\begin{multlined}[t][.75\textwidth]
\approx B^{3}C^{-2}\frac{D}{E_{\text{test}}}\arctan(CE)\left( f_{0}(G)+2Bf_{1}(G)\vphantom{\frac{3}{4}}\right.\\
\left.+\frac{1}{7}B^{2}\left(f_{0}(G)+f_{2}(G)\right) \right)
\end{multlined}\\
B &\approx 7A
\end{align}
@RazerM
RazerM / gist:5200401
Created March 19, 2013 21:42
LaTeX: Figure #snippet
\begin{figure}[H]
\begin{center}
\includegraphics[width=0.9\textwidth]{filename}
\end{center}
\caption{}
\label{fig:name}
\end{figure}
@RazerM
RazerM / gist:5150731
Last active December 14, 2015 21:19
LaTeX: Number aligned table #snippet
%Needs \usepackage{float} for {H}
\begin{table}[H]
\centering
% table-format is defined as a.b where a is number of figures before decimal point, b is number of decimal places
\begin{tabular}{S[table-format=1]S[table-format=2.1]} %First S sets format for both columns, but each can have different table-format
\toprule
{ Distance (\si{\metre}) } & { Speed (\si{mi\per\hour}) }\\ %Non-number input must be surrounded with { }
\midrule
0 & 0 \\
1 & 1.1 \\
@RazerM
RazerM / gist:5150716
Last active December 14, 2015 21:19
LaTeX: Simple table #snippet
%Needs \usepackage{float} for {H}
\begin{table}[H]
\centering
\begin{tabular}{*{2}{l}rr@{.}l} %The same as llr
\toprule
\multicolumn{2}{c}{Item}\\ %2 columns, centred
\cmidrule(r){1-2} %Trims bar on r.h.s.
Meat & Description & Price (\textsterling) & \multicolumn{2}{c}{Mass (kg)}\\
\midrule
Chicken & Breast & 4.69 & 5 & 2\\
@RazerM
RazerM / gist:5150638
Created March 13, 2013 09:47
LaTeX: Tabbing #snippet
\begin{Tabbing}
\hspace{2em} \TAB=A\hspace{2em} \TAB=B\hspace{2em} \TAB=C\hspace{4em} \TAB=Description\\
Unindented line\\
\TAB>Indented \TAB>\TAB>\TAB>\textbackslash TAB\textgreater\ moves \textbf{only} the current line to the next tab stop\\
\TAB+ Current line unindented.\TAB>\TAB>\TAB>\TAB>\textbackslash TAB+ indents the lines following (but not including) the current line.\\
Following line indented.\TAB-\\
Remove indent.\TAB>\TAB>\TAB>\TAB>\textbackslash TAB- unindents the following lines.\\
Back to unindented.\\
\TAB>\TAB> Two tabs.\TAB>\TAB>\textbackslash TAB commands work as expected when stacked together.\\
\TAB+\TAB> Combined. \TAB>\TAB>\TAB>\textbackslash TAB+\textbackslash TAB\textgreater\ can be used to start the indent immediately and for following lines.\\