Skip to content

Instantly share code, notes, and snippets.

@varfrog
varfrog / vm-host-os.md
Last active November 30, 2023 11:43
vm-host-os.md

Host configuration

Resolve the guest IP:

From the output of ip addr show on the guest: near enp023 (in my case):

inet 192.168.0.106/24 (...)

hence the guest IP is 192.168.0.106.

Guest configuration

Enable packet forwarding:

In /etc/sysctl.conf uncomment the next line to enable packet forwarding for IPv4. net.ipv4.ip_forward=1:

Set a routing rule

Run ip addr show

package main
import (
"fmt"
"os"
)
const (
fileStateOpen int = iota + 1
fileStateClosed
<?php
class BalanceSheet
{
public function __construct(public int $liabilities, public int $equity)
{
}
}
class AssetsCalculator
@varfrog
varfrog / transformation-demo.clj
Last active August 2, 2021 22:23
Transformation demo
(defrecord BalanceSheet [liabilities equity])
(defn calc-assets
[^BalanceSheet bs]
(+ (:liabilities bs) (:equity bs)))
(defn replace-vals-with-assets
"{:key1 BalanceSheet, ...} -> {:key1 (calc-assets BalanceSheet), ...}."
[sheets]
(reduce-kv (fn [m k v]
@varfrog
varfrog / php-empty
Last active February 15, 2021 13:20
php empty()
<?php
$foo = '0';
echo empty($foo) ? 1 : 0;
echo PHP_EOL;

Keybase proof

I hereby claim:

  • I am varfrog on github.
  • I am agrigutis (https://keybase.io/agrigutis) on keybase.
  • I have a public key ASB0hIE-NYkotY_Pr5PaduyXmQC5bvTG_SRNXjDX3cn-JAo

To claim this, I am signing this object: