Skip to content

Instantly share code, notes, and snippets.

@swuecho
swuecho / Virtual Box Host Only Static IP.md
Created May 31, 2018 05:27 — 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

dashboard "Food":
- h1 text: Food
- h2 text: By caloric content
- 3 columns:
- rows:
- h3 text: Bananas
- pie chart: {
"columns": [
["Protein", 5], ["Sugar", 10], ["Other carbs", 40], ["Fat", 1]
]
dashboard "Food":
- h1 text: Food
- h2 text: By caloric content
- 3 columns:
- rows:
- h3 text: Bananas
- pie chart: {
"columns": [
["Protein", 5], ["Sugar", 10], ["Other carbs", 40], ["Fat", 1]
]
@swuecho
swuecho / playground.rs
Created December 14, 2017 17:22 — forked from anonymous/playground.rs
Rust code shared from the playground
use std::str::FromStr;
fn main () {
let mut input = "15 Bear".split(' ');
// Need to pull the number and parse it.
let number = input.next()
// Process Option<&'static str> to Option<int>
.and_then(|x| i32::from_str(x).ok() )
.expect("Was not provided a valid number.");
// The next token is our animal.
@swuecho
swuecho / playground.rs
Created December 14, 2017 17:17 — forked from anonymous/playground.rs
Rust code shared from the playground
fn main () {
let number: f64 = 20.;
// Perform a pipeline of options.
let result = Some(number)
.map(inverse) // Described below.
.map(double)
.map(inverse)
.and_then(log) // Described below.
.map(square)
.and_then(sqrt);
Prelude> (fmap . const) 1 [1..5]
[1,1,1,1,1]
Prelude> fmap . const 1 [1..5]
<interactive>:29:1: error:
• Non type-variable argument in the constraint: Num (a1 -> a -> b)
(Use FlexibleContexts to permit this)
• When checking the inferred type
it :: forall b a (f :: * -> *) a1.
(Num (a1 -> a -> b), Functor f) =>
@swuecho
swuecho / pet-snippet.toml
Last active March 13, 2017 21:14
description
[[snippets]]
description = "list all files "
command = "ls -lah"
@swuecho
swuecho / gist:c0e9394b183edf120362390b6f4b808f
Created March 9, 2017 00:56 — forked from aidanhs/gist:5ac9088ca0f6bdd4a370
Rust binary tree worked example

% Let's build a binary tree!

Let's build a binary tree of strings in Rust. To recap, each node in a binary tree:

  1. must have a value
  2. may or may not have left and/or right children

So we can describe a single node like this:

#!/usr/local/bin/perl
package MyAnalyzer {
use v5.10;
use base qw( Lucy::Analysis::Analyzer );
sub new {
my $self = shift->SUPER::new;
return $self;
}
https://godbolt.org/g/cmHlPR