As configured in my dotfiles.
start new:
tmux
start new with session name:
#include "EventDispatcher.h" | |
void EventDispatcher::addListener( Listener *l ) | |
{ | |
mListeners.push_back(l); | |
} | |
void EventDispatcher::removeListener( Listener *l ) | |
{ | |
mListeners.erase( std::remove( mListeners.begin(), mListeners.end(), l ), mListeners.end() ); |
#!/usr/bin/env bash | |
dir=$(dirname $0) | |
gconfdir=/apps/gnome-terminal/profiles | |
echo # This makes the prompts easier to follow (as do other random echos below) | |
######################## | |
### Select a profile ### | |
######################## |
As configured in my dotfiles.
start new:
tmux
start new with session name:
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
#include <iostream> | |
#include <map> | |
using namespace std; | |
class BaseClass{ | |
public: | |
virtual int funk() { | |
return 0; | |
} |
extern mod extra; | |
use extra::json::*; | |
/* | |
* This function manages to do absolutely no copying, which is pretty cool. | |
* | |
* "What are all those `'r`s?" you ask. Well, they're liftime parameters. They | |
* indicate how long something lasts (before it's freed). They can't change how | |
* long something lives for, they only allow you to tell the compiler stuff it |
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.
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
; ___ _ __ ___ __ ___ | |
; / __|_ _ __ _| |_____ / /| __|/ \_ ) | |
; \__ \ ' \/ _` | / / -_) _ \__ \ () / / | |
; |___/_||_\__,_|_\_\___\___/___/\__/___| | |
; An annotated version of the snake example from Nick Morgan's 6502 assembly tutorial | |
; on http://skilldrick.github.io/easy6502/ that I created as an exercise for myself | |
; to learn a little bit about assembly. I **think** I understood everything, but I may | |
; also be completely wrong :-) |
tl;dr: Avoid Box<T>
in general.
Actually, this rule is so important that the Rust Pointer Guide explicitly says the same. Therefore without a further ado, you should avoid Box<T>
except for these three cases:
When you absolutely need a trait object (Box<Trait>
). But review carefully to see if it is indeed absolutely needed; you may try to generalize things too far, for example.
When you have a recursive data structure. This may be mandatory when you have an inherently recursive data (e.g. scene graph), but it may also be a sign of the premature optimization. Again, review carefully to see if you need to write a separate data structure yourself, and use the collection
crate if possible.