Skip to content

Instantly share code, notes, and snippets.

View brianmcgee's full-sized avatar

Brian McGee brianmcgee

View GitHub Profile
@brianmcgee
brianmcgee / flake.nix
Created August 17, 2025 18:33
An example of pinning nixpkgs using flakes and a sample nixos configuration
{
description = "An example of pinning nixpkgs";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
nixpkgsPinned.url = "github:nixos/nixpkgs?rev=e07c1ba3ce542747dd0941a459b90259e228478d";
};
outputs = { self, nixpkgs, nixpkgsPinned, ... }: let
# NOTE: this is a very 'flat' and vanilla flake. The structure might look a bit different if you're using flake-parts,
@brianmcgee
brianmcgee / any-home-manager-module.nix
Created August 9, 2023 15:05
Passing hostname into home-manager
{ config, inputs, hostName, ... }: {
// hostName should now be available as an arg to all of your home-manager modules
}
@brianmcgee
brianmcgee / 1_possible_ether_destruction.md
Last active July 29, 2019 11:42
Possible Ether Destruction Scenario

Scenario

  1. Contract A (0x41275dcfcf2a8c3edc94f87da477d38a2ca56390) is created in Block #5470416 and has a balance of 0 Ether.

  2. Contract B (0x32fc1ad1de149a3c9e0bf4aff2989f699eaae30f) is created by Contract A in Block #5470419 and within the same transaction the following occurs:

    • Contract A calls Contract B with 0.1 Ether.
    • Contract B calls itself with 0.1 Ether and in a sub call transfers 0.000000000001193046 Ether to a third address (0x30bc5920a76b483080523482d7fc2b64c9d5bd80)/
    • Contract B self destructs, refunding its balance of 0.099999999998806954 Ether to Contract A.
  • Contract A calls the now destroyed Contract B with 0.099999999998806954 Ether.