Skip to content

Instantly share code, notes, and snippets.

View flippingbitss's full-sized avatar
:octocat:

Manpreet Singh Matharu flippingbitss

:octocat:
  • Toronto
View GitHub Profile
@flippingbitss
flippingbitss / decode-8086-mov.rs
Created November 11, 2024 02:50
MOV instruction decoding on 8086 for computerenhance.com
// mov ax, bx
// instruction - dest reg
// 6 bits(bit pattern for mov) - D W | MOD (2) - REG(3) - R/M(3)
use std::fmt::Display;
const REG_NAMES_R: [&str; 8] = ["al", "cl", "dl", "bl", "ah", "ch", "dh", "bh"];
const REG_NAMES_W: [&str; 8] = ["ax", "cx", "dx", "bx", "sp", "bp", "si", "di"];
#[repr(u8)]
@flippingbitss
flippingbitss / haversine.rs
Created November 9, 2024 05:54
the-haversine-distance-problem from computerenhance.com
use serde::Deserialize;
use std::{
fs::File,
io::{BufReader, Read},
time::Instant,
};
#[derive(Deserialize)]
struct Pair {
x0: f32,
import 'package:flutter/material.dart';
import 'dart:math' show pi;
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
class PlayButton extends StatefulWidget {
final bool initialIsPlaying;
final Icon playIcon;
final Icon pauseIcon;
final VoidCallback onPressed;
PlayButton({
@required this.onPressed,
this.initialIsPlaying = false,
this.playIcon = const Icon(Icons.play_arrow),
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
class Blob extends StatelessWidget {
final double rotation;
final double scale;
final Color color;
const Blob({@required this.color, this.rotation = 0, this.scale = 1})
: assert(color != null);
@override
Widget build(BuildContext context) {