Skip to content

Instantly share code, notes, and snippets.

View mikejk8s's full-sized avatar
🦀

Mike Johnson mikejk8s

🦀
View GitHub Profile

Rust Cheat Sheet

Variables & Mutability

Variables are immutable by default. This makes Rust safer and makes concurrency easier.
Immutable means once a value is bound to that variable, it cannot be changed.
For example:

fn main() {
 let x = 5;
@mfgbhatti
mfgbhatti / MOTD.md
Last active February 11, 2024 05:03
Ubuntu like motd for arch linux systems
#!/usr/bin/env bash
# ____ __ __ __ __ _
# ____ ___ / __/___ _/ /_ / /_ ____ _/ /_/ /_(_)
# / __ `__ \/ /_/ __ `/ __ \/ __ \/ __ `/ __/ __/ /
# / / / / / / __/ /_/ / /_/ / / / / /_/ / /_/ /_/ /
#/_/ /_/ /_/_/ \__, /_.___/_/ /_/\__,_/\__/\__/_/
# /____/
#
# https://gist.github.com/mfgbhatti/2c2ea5da5d6d7e608d90fd43d4daa4a8
@sts10
sts10 / rust-command-line-utilities.markdown
Last active May 4, 2024 23:11
A curated list of command-line utilities written in Rust

A curated list of command-line utilities written in Rust

Note: I have moved this list to a proper repository. I'll leave this gist up, but it won't be updated. To submit an idea, open a PR on the repo.

Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.

The ones I use regularly include: bat, dust, fd, fend, hyperfine, miniserve, ripgrep, just, cargo-audit and cargo-wipe.

  • atuin: "Magical shell history"
  • bandwhich: Terminal bandwidth utilization tool
@GitMurf
GitMurf / obsidian.templater.quick-capture.js
Last active April 22, 2024 15:14
Obsidian Quick Capture using templater. Activate from anywhere in your vault to record quick ideas, notes, time logging, etc. The Quick Capture file does NOT need to be open.
<%*
//v1.4: Adding option for including a header for each DNP day to fold
//'first' will add to top of file. 'last' will add to bottom of file
let firstOrLastLine = 'first';
//Name of the Quick Capture file. Do NOT include extension '.md'
let qcFileName = 'Quick Capture';
//Leave this blank if you want to use the default file path location (set to '/' to use root of vault)
@janeczku
janeczku / tf-rancher-cluster-template.md
Last active July 20, 2020 22:29
Rancher Cluster from RKE Template TF

Fetch details of an existing RKE cluster template:

data "rancher2_cluster_template" "hardened" {
    name = "hardened-template"
}

or create a new RKE cluster template:

@vairisingh
vairisingh / install-teleport.sh
Created June 27, 2020 03:39
Script to install Teleport on a system
#!/bin/bash
export version=v4.2.8
export os=linux
export arch=amd64
#####################################
curl -O https://get.gravitational.com/teleport-$version-$os-$arch-bin.tar.gz
tar -xzf teleport-$version-$os-$arch-bin.tar.gz
[wsl2]
kernel=C:\\Users\\JAKA\\vmlinux
@Andor
Andor / .gitlab-ci.yml
Last active February 28, 2023 15:03
terraform .gitlab-ci.yml
---
variables:
terraform_image: terraform-vault-jq
default:
image:
name: $terraform_image
cache:
key: terraform
paths:
@jimangel
jimangel / readme.md
Last active April 17, 2021 14:47
Examples of how to test the impact of the v1.16 API deprecations

Kubernetes v1.16 API deprecation testing

Examples of how to test the impact of the v1.16 API deprecations and ways to debug early!

If this is the first time you're hearing of these deprecations STOP and read this blog post (thanks @vllry!).

Common misunderstandings

  1. The exact apiVersion: value that I use in my manifest is stored on disk (etcd).
@kutzhanov
kutzhanov / .gitlab-ci.yml
Last active November 22, 2022 20:50
Deploy Docker container into AWS ECS Fargate using Gitlab CI
image: docker:19.03
variables:
REPOSITORY_URL: <AWS_ACCOUNT_ID>.dkr.ecr.<REGION_NAME>.amazonaws.com/<ECR_REPOSITORY_NAME>
REGION: <REGION_NAME>
TASK_DEFINITION_NAME: <TASK_DEFINITION_NAME>
CLUSTER_NAME: <CLUSTER_NAME>
SERVICE_NAME: <SERVICE_NAME>
CPU: <CPU>
MEMORY: <MEMORY>