Skip to content

Instantly share code, notes, and snippets.

View XVilka's full-sized avatar
💭
Rusting

Anton Kochkov XVilka

💭
Rusting
View GitHub Profile
@ityonemo
ityonemo / test.md
Last active April 7, 2024 14:48
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

@DoctorWkt
DoctorWkt / NOTES.md
Created May 10, 2020 09:07
Debian 10 Running on qemu-system-m68k
@ivg
ivg / bytoy.ml
Last active August 12, 2020 15:41
Lifting a toy bytecode using Core Theory
open Core_kernel
open Bap_core_theory
open Bap.Std
open KB.Syntax
include Self()
let package = "bytoy"
type name = string [@@deriving equal,sexp]
type oper = Reg of int | Imm of int [@@deriving equal,sexp]
@edmundsmith
edmundsmith / writeup.md
Created July 7, 2019 20:47
Method for Emulating Higher-Kinded Types in Rust

Method for Emulating Higher-Kinded Types in Rust

Intro

I've been fiddling about with an idea lately, looking at how higher-kinded types can be represented in such a way that we can reason with them in Rust here and now, without having to wait a couple years for what would be a significant change to the language and compiler.

There have been multiple discussions on introducing higher-ranked polymorphism into Rust, using Haskell-style Higher-Kinded Types (HKTs) or Scala-looking Generalised Associated Types (GATs). The benefit of higher-ranked polymorphism is to allow higher-level, richer abstractions and pattern expression than just the rank-1 polymorphism we have today.

As an example, currently we can express this type:

@sigmaris
sigmaris / build_qemu_debian_image.sh
Last active March 21, 2024 06:13
Automate the installation of Debian Buster on a x86_64 QEMU 4.0.0 VM hosted on macOS
#!/bin/bash -e
if [ "$(uname -s)" != "Darwin" ]
then
echo "This script is for building a Debian x86_64 image to use on MacOS"
exit 1
fi
TEMP="$(mktemp -d build.XXXXX)"
cp preseed.cfg $TEMP
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active April 23, 2024 03:11
Hyperlinks in Terminal Emulators

When you set Let's Encrypt up, you will:

  • generate a key on your computer (among other things), which we will call domain.key
  • regularly update a certificate file via Let's Encrypt (most probably using one of the Acme Client Implementations), we will call this file domain.crt

The domain.key file is for your eyes only; you should keep it safe where you run taskd and set server.key to point to it.

@Cr4sh
Cr4sh / ami_smi_dump.py
Last active November 14, 2022 10:20
Extract SW SMI handlers information from SMRAM dump of Skylake based AMI Aptio V firmware
'''
###########################################################################
Extract SW SMI handlers information from SMRAM dump of Skylake based
AMI Aptio V firmware.
To use full capabilities of this tool you need to install UEFIDump
(https://github.com/LongSoft/UEFITool/releases/tag/A32), ida-efiutils
(https://github.com/snare/ida-efiutils) and edit corresponding variables
below.
@brettle
brettle / Creating a bootable usb stick containing a direct install of Ubuntu 14.04 from Fedora 23.md
Last active September 26, 2017 05:53
Creating a bootable usb stick containing a direct install of Ubuntu 14.04 from Fedora 23

Instructions

  1. Download the Ubuntu 14.04 Live Desktop (64-bit) iso.
  2. Enable virtualization in the BIOS.
  3. sudo dnf install qemu-kvm
  4. Install the UEFI bios images.
  5. As root, boot the ISO in a virtual machine:
isopath=/path/to/ubuntu-14.04.3-desktop-amd64.iso
stickdev=/dev/sdX # Make sure this is set to the device for your usb stick
qemu-kvm -drive file=$stickdev,format=raw -m 2048 -pflash /usr/share/edk2.git/ovmf-x64/OVMF-pure-efi.fd -cdrom $isopath
@Sgeo
Sgeo / gadts.rs
Last active July 14, 2023 12:14 — forked from mstewartgallus/gadts.rs
Gadts in Rust
/// This type is only every inhabited when S is nominally equivalent to T
#[derive(Debug)]
pub struct Is<S, T>(::std::marker::PhantomData<(*const S, *const T)>);
// Construct a proof of the fact that a type is nominally equivalent
// to itself.
pub fn is<T>() -> Is<T, T> { Is(::std::marker::PhantomData) }
// std::mem::transmute does not accept unsubstituted type parameters
// manual transmute as suggested by manual