sudo pacman -S \
qemu libvirt virt-manager \
ebtables nfs-utils dnsmasq vagrant
vagrant plugin install vagrant-libvirt vagrant-mutate
vagrant plugin install vagrant-hostmanager vagrant-cachier # Optional
sudo usermod -a -G libvirt `whoami`
sudo systemctl restart libvirtd # Make sure ebtables installation takes effect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::mem::size_of; | |
| use ring::aead::{self, Nonce, NonceSequence}; | |
| /// The u128 is treated as an 11 byte counter, and will panic on overflow | |
| const COUNTER_BYTES: usize = 11; | |
| const COUNTER_MAX_SIZE: u128 = 1 << (8 * COUNTER_BYTES); | |
| pub(crate) struct CounterNonceSequence(u128); | |
| impl NonceSequence for CounterNonceSequence { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::collections::BTreeMap; | |
| use chumsky::{error::Error, prelude::*}; | |
| fn main() { | |
| assert_eq!(parser().parse("hello!").into_result(), Ok(Value::String("hello!".to_string()))); | |
| assert_eq!( | |
| parser().parse("{a: b, c: {d: e}}").into_result(), | |
| Ok(Value::Map(BTreeMap::from([ | |
| (Value::String("a".to_string()), Value::String("b".to_string())), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [package] | |
| name = "rust_example" | |
| version = "0.1.0" | |
| edition = "2021" | |
| [dependencies] | |
| chumsky = { version = "1.0.0-alpha.4", git = "https://github.com/jess-sol/chumsky.git", branch = "topic/map_with_ctx", features = [ | |
| "serde", | |
| ] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #[derive(Clone, Debug)] | |
| enum Direction { Left, Right } | |
| #[derive(Clone, Debug)] | |
| struct DirectionalDigit(Direction, usize); | |
| impl std::fmt::Display for DirectionalDigit { | |
| fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | |
| match self.0 { | |
| Direction::Left => write!(f, "<{}", self.1), | |
| Direction::Right => write!(f, "{}>", self.1), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| printf '' | sudo tee /etc/dnsmasq.d/minikube.conf | |
| while IFS= read -r profile; do | |
| cat <<EOF | sudo tee -a /etc/dnsmasq.d/minikube.conf | |
| server=/$profile.invalid/$(minikube ip --profile "$profile") | |
| address=/$profile.invalid/$(minikube ip --profile "$profile") | |
| EOF | |
| done < <(minikube profile list -o json | jq -r '.valid[] | select(.Config.Addons."ingress-dns") | .Name') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| ACCESS_TOKEN=$(< token) | |
| function ddns { | |
| local record="domain.tld" | |
| local domain="exiting.a.record" | |
| ip="$(curl -s http://checkip.amazonaws.com/)" | |
| record_id="$(get_id_for_name "$record" "$domain")" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pyspark | |
| from pyspark import SparkConf, SparkContext | |
| from pyspark.sql import SparkSession, Window, Row | |
| from datetime import datetime | |
| import pyspark.sql.types as T | |
| BUCKETS = 5 | |
| sc = pyspark.SparkContext('local[*]') | |
| spark = SparkSession(sc) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo yum install \ | |
| git gcc zlib-devel bzip2-devel readline-devel \ | |
| sqlite-devel openssl-devel libffi-devel | |
| git clone https://github.com/pyenv/pyenv.git ~/.pyenv | |
| cat <<'EOF' >> ~/.bash_profile | |
| export PYENV_ROOT="$HOME/.pyenv" | |
| export PATH="$PYENV_ROOT/bin:$PATH" | |
| if command -v pyenv 1>/dev/null 2>&1; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extern crate subprocess_communicate; | |
| extern crate encoding; | |
| use std::path::Path; | |
| use std::process::{Command, Stdio, Child}; | |
| use self::subprocess_communicate::subprocess_communicate; | |
| use self::encoding::all::UTF_8; | |
| use self::encoding::{Encoding, EncoderTrap, DecoderTrap}; |
NewerOlder