Skip to content

Instantly share code, notes, and snippets.

View drguildo's full-sized avatar
🖕

Simon Morgan drguildo

🖕
View GitHub Profile
@drguildo
drguildo / vs-sucks.md
Last active October 22, 2024 08:41
Reasons Visual Studio is the worst piece of software ever made.

Visual Studio Sucks

  1. It's extremely slow.
    1. https://www.youtube.com/watch?v=GC-0tCy4P1U
    2. It's so bad it now displays this message in the text window before the actual text: image
  2. When in debugging mode, the method details dialog that appears when you hover over the method name doesn't work.
  3. The performance profiler is, ironically, extremely slow. image

Miscellaenous

@drguildo
drguildo / the-witcher3-mods.md
Last active December 5, 2021 17:10
The Witcher 3 mods that I recommend.
  • Auto Apply Oils-625-v1-31-2-1594325041.zip
  • AutoLoot AIO 3.0 for Patch 1.31-1996-3-0-5.7z
  • Brothers In Arms Ultimate Bug Fix Collaboration-5752-2-2-1629241468.7z
  • Fast Stash Menu-3931-1-0-1566500962.rar
  • modAxiiFix_1.0.zip-4493-1-0-1584199298.zip
  • modMapQuestObjectives-1.30-v10.zip-943-1-30-10.zip
  • Over 9000 - Weight limit mod v1.31-3-1-31.zip
  • Realistic Weather 2.1-2084-2-1.rar

C data type sizes

C type Intel data type Assembly suffix Bytes
char Byte b 1
short Word w 2
int Double word l 4
long Quad word q 8
char * Quad word q 8
float Single precision s 4
#include <stdio.h>
#include <stdint.h>
typedef struct {
char a;
long b;
char c;
} Struct;
int main(int argc, char const *argv[])
@drguildo
drguildo / bisbic.c
Last active September 16, 2020 21:39
Solution to Practice Problem 2.13 in Computer Systems: A Programmer's Perspective.
#include <stdio.h>
void dump(unsigned int i) {
printf("%#08x = %d\n", i, i);
}
/* Declarations of functions implementing operations bis and bic */
int bis(int x, int m) {
return x | m;
}
fn foo1() {
let foo: Option<i32> = Some(1234);
println!("{}", foo.unwrap_or(4321));
let bar = foo;
}
fn foo2() {
let foo: Option<String> = Some("1234".to_string());
println!("{}", foo.unwrap_or("4321".to_string()));
@drguildo
drguildo / fs.zig
Last active September 19, 2022 18:19
const std = @import("std");
const fs = std.fs;
const warn = std.debug.warn;
pub fn main() !void {
const cwd = try fs.cwd().openDir(".", fs.Dir.OpenDirOptions{
.iterate = true,
});
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
const std = @import("std");
const fs = std.fs;
const warn = std.debug.warn;
pub fn main() !void {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = &arena.allocator;
const cwd = try fs.cwd().openDir(".", fs.Dir.OpenDirOptions{
@drguildo
drguildo / bf.nim
Last active September 7, 2024 19:54
import os
import streams
import system
import tables
var data: array[30_000, byte]
var dataPointer: int = 0
var instructions: seq[char]
var instructionPointer: int = 0
@drguildo
drguildo / covariance-and-contravariance.cs
Last active February 4, 2020 09:29
Covariance and contravariance.
static void SetObject(object o) { }
void Main()
{
// Assignment compatibility.
string str = "test";
// An object of a more derived type is assigned to an object of a less derived type.
object obj = str;
// Covariance.