.     .       .  .   . .   .   . .    +  . 
                      .     .  :     .    .. :. .___---------___.
                           .  .   .    .  :.:. _".^ .^ ^.  '.. :"-_. .
                        .  :       .  .  .:../:            . .^  :.:\.
                            .   . :: +. :.:/: .   .    .        . . .:\
                     .  :    .     . _ :::/:               .  ^ .  . .:\
                      .. . .   . - : :.:./.                        .  .:\
                      .      .     . :..|:                    .  .  ^. .:|
                        .       . : : ..||        .                . . !:|
                      .     . . . ::. ::\(                           . :)/
                     .   .     : . : .:.|. ######              .#######::|
                      :.. .  :-  : .:  ::|.###=###           ..###=####:|
                     .  .  .  ..  .  .. :\ ##=##=##          :##=##=## :/
                      .        .+ :: : -.:\ ###=####       . ####=###.:/
                        .  .+   . . . . :.:\. #######       #######..:/
                          :: . . . . ::.:..:.\           .   .   ..:/
                       .   .   .  .. :  -::::.\.       | |     . .:/
                          .  :  .  .  .-:.":.::.\             ..:/
                     .      -.   . . . .: .:::.:.\.           .:/
                    .   .     : . : .:.:::.: .:.:.:\   .__.   :/
                       .   .  .   .:. .. .  .: :.:.:\       :/
                         +   .   .   : . ::. :.:. .:.|\  .:/|
                         .         +   .  . w...:: ..|  --.:|
                    .      . . .   .  .  . ..h:..:.."(   ..)"
                     .   .       .      :  .  y.: ::/  .  .::\ ........
                

This government server contains highly classified UFO data. Unauthorized access is strictly prohibited.

root@blackmage:~$

fatal: bad object refs/remotes/origin/HEAD

git remote set-head origin -d error: cannot lock ref 'refs/remotes/origin/HEAD': unable to resolve reference 'refs/remotes/origin/HEAD': reference broken error: Could not delete refs/remotes/origin/HEAD rm .git/refs/remotes/origin/HEAD git remote set-head origin -a origin/HEAD set to master

List Full Commit Messages for a Specific Git Branch

git log "develop..feature/#388_ImplementBackFlushing" --pretty=format:"%B"

Reset changes to origin

git fetch origin git reset --hard origin/master

Reset changes local gitrepo

git reset - unstage all files git checkout . revert all changes git checkout [some_dir|file.txt] revert only that file -- safe way -- git stash -- verify you are in the state you want git stash drop -- if ok just drop the stash

What is the meaning of ^M in 'git diff'?

^M represents carriage return. This diff means something removed a Unicode BOM from the beginning of the line and added a CR at the end. The ^ symbol stands for Control, so ^M means Ctrl+M. To get from that to the actual ASCII character code, you take the base character and flip bit 6 (i.e. XOR with 64). For letters, that just means subtract 64. So, for example, ^A is character code 1 (because A is 65). ^M is 77 - 64 = 13 (because M is 77), which corresponds to carriage return in ASCII. Set windows style: git config --global core.autocrlf true git config --global core.eol crlf

Practical uses of git reset --soft?

# Move the HEAD, and just the HEAD, one commit back! git reset --soft HEAD^ # Move the HEAD, and just the HEAD, two commits back! git reset --soft HEAD^^

Origin

# Get list of locations git remote -v # Change the Origin git remote set-url origin https://git-repo/new-repository.git

Origin

# history path for powershell (Get-PSReadlineOption).HistorySavePath # Open it in code code (Get-PSReadlineOption).HistorySavePath

Delta

Install: winget install dandavison.delta Config: git config --global core.pager delta

Patch

cmd: git add --patch s -> splitt y -> stage hunk n -> not stage hunk git diff --staged for the y

search commits

cmd: git lg -S 'Searchtearm' git lg -L:functionName:src/file.cs

Update and clean when updating .gitignore

steps: step1: add files or folders to gitignore step2: remove the files from the git cache git rm -r --cache "FolderName" step3: comit the curren change git commit -m "removed FolderName folder from git chache and updated the .gitignore file" step4: push the chang git push

Cleanup branches git

cmd: git fetch -p origin From https://github.com/glennwiz/StoryTeller - [deleted] (none) -> origin/feature/Broken - [deleted] (none) -> origin/feature/DiscordBot - [deleted] (none) -> origin/feature/MakeASelectionForChatBotOrStoryteller - [deleted] (none) -> origin/masterBackup * [new branch] develop -> origin/develop git branch --merged | where { $_ -notlike '*main*' -and $_ -notlike '*master*' } | ForEach-Object { git branch -d $_.Trim() } Deleted branch feature/DiscordBot (was 710545f). Deleted branch feature/LoopbackBot (was f41bf42). Deleted branch feature/MoveTheInferenceToStaticOrEventHandling (was 034de96). Deleted branch feature/SystemDesignFix (was 90ef8ed). Deleted branch feature/memory (was bfd7e08).

Cleanup branches git

icmp allow Rule New-NetFirewallRule -DisplayName "ICMP Trippy Allow" -Name ICMP_TRIPPY_ALLOW -Protocol ICMPv4 -Action Allow -- Enable-NetFirewallRule ICMP_TRIPPY_ALLOW Disable-NetFirewallRule ICMP_TRIPPY_ALLOW

Versioning pipeline nugets

icmp allow variables: major: '1' minor: '0' revision: $[counter(variables['minor'], 1)] #this will get reset when minor gets bumped. The number after Counter is the seed number (in my case, I started at 1). app_version: '$(major).$(minor).$(revision)'

visual studio comapatible nerdfont https://eng.m.fontke.com/font/64992431/download

msbuild and vstest.console in to Path

[System.Environment]::SetEnvironmentVariable("Path", [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine) + ";C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\TestPlatform;C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin", [System.EnvironmentVariableTarget]::Machine) $env:PATH -split ';'
Build.ArtifactStagingDirectory - The local path on the agent where any artifacts are copied to before being pushed to their destination. For example: c:\agent_work\1\a Build.BinariesDirectory - The local path on the agent you can use as an output folder for compiled binaries. For example: c:\agent_work\1\b. Build.Repository.LocalPath - The local path on the agent where your source code files are downloaded. For example: c:\agent_work\1\s. This variable is synonymous with Build.SourcesDirectory.
selections .\nano.exe pwd Path ---- C:\Program Files\Git\usr\bin
in Odin Lang just do Ansi Escape Codes for console collours https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences fmt.println("\033[31mRED TEXT\033[0m")
AOS = "Array of structures" SOA = "Struct of arrays"

package main

import "core:fmt"
import "core:math/rand"

GRID_SIZE :: 64

// CellGrid defines a 64x64 grid of boolean values
CellGrid :: [GRID_SIZE][GRID_SIZE]bool

main :: proc() {

    // Create a 64x64 grid of boolean values
    grid := CellGrid{}
    for i := 0; i < GRID_SIZE; i = i + 1 {
        for j := 0; j < GRID_SIZE; j = j + 1 {
            grid[i][j] = false
        }
    }
    
    for i := 0; i < GRID_SIZE; i = i + 1 {
        for j := 0; j < GRID_SIZE; j = j + 1 {
            
            v := rand.int_max(2)
            grid[i][j] = v == 1            
        }
    }

    // Print the grid
    for i := 0; i < GRID_SIZE; i = i + 1 {
        for j := 0; j < GRID_SIZE; j = j + 1 {
            if grid[i][j] {
                fmt.print("#")
            } else {
                fmt.print(".")
            }
        }
        fmt.println("")
    }


    fmt.println("Random u32: ",rand.uint32());

    // Using local random number generator
    my_rand := rand.create(1)
    fmt.println(rand.uint32(&my_rand))
    fmt.println(rand.uint32(&my_rand))

    //get random 0 - 9 
    //https://pkg.odin-lang.org/core/math/rand/#int_max   
    fmt.println(rand.int_max(10))
    fmt.println(rand.int_max(10))
    fmt.println(rand.int_max(10))
    fmt.println(rand.int_max(10))
    fmt.println(rand.int_max(10))

    //get random 0 - 1
    fmt.println(rand.int_max(2))
    fmt.println(rand.int_max(2))
    fmt.println(rand.int_max(2))
    fmt.println(rand.int_max(2))
     
    value := 42             // An integer variable
    ptr := &value           // A pointer to the integer variable      

    fmt.println("Value before:", value)
    fmt.println("Pointer address:", ptr)

    ptr^ = 21               // Dereferencing the pointer and changing the value it points to
    fmt.println("Value after:", value)  
    fmt.println("1-----------------")

    i := 123 
    p: ^int                 // Declare a pointer to an integer
    p = &i                  // p now holds the address of i
    fmt.println("Memory address of i:", p) 
    fmt.println("Value of i through p:", p^) // Dereference p to read i's value
    p^ = 1337               // Modify i through the pointer p
    fmt.println("New value of i:", i) 

    fmt.println("2-----------------")

    cell_status := true
    p_cell := &cell_status  // Pointer to cell_status
    fmt.println("Memory address of cell_status:", p_cell)
    p_cell^ = false         // Modify cell_status through the pointer
    fmt.println("New value of cell_status:", p_cell^)

    fmt.println("3-----------------")

    // Demonstrating pointer usage with strings
    stringX := "Gemstones"
    p_string := &stringX    // Pointer to stringX
    p_string^ = "are"       // Modify stringX through the pointer
    p_string^ = "gems"      // Modify stringX again

    fmt.println("Should print 'gems':", stringX)
}
        
	

DI in console app


using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

IHost _host = Host.CreateDefaultBuilder(args).ConfigureServices(s => {
    s.AddSingleton();
}).Build();

var app = _host.Services.GetRequiredService();
app.Run();

internal class Application
{
    private readonly ILogger _logger;

    public Application(ILogger logger)
    {
        logger.LogInformation("Application is starting");
        _logger = logger;
    }

    public void Run()
    {
        _logger.LogInformation("Logging application is running");
        System.Console.WriteLine("Application is running");
    }
}
            

        

Action map


var actions = new Dictionary<string, Action>{
    ["action1"] = () => action1(),
    ["action2"] = () => Console.WriteLine("action2"),
    ["action3"] = () => Console.WriteLine("action3")
};

actions["action1"]();

public void action1()
{
    Console.WriteLine("action1");
}
        

Vim remeber

        
            commands: set relativenumber,  set number 
            shift vjjjy - yank in to buffer
            h rtp - Config paths - runtimepaths 
            ------------------------------
            then d elete everything un t il the next space: dtspace.
            dtspace or dt" osv.
            move line up or down
            ddp - down | ddkkp - up
            ------------------------------
            Vim movments
            _ -> begining
            $ -> end
            - -> begining line over
            w -> word
            f(Char) -> to next char
            t(Cha)-> same as f but char before                
            , and ; -> repeat f and t
            o and O -> New Line Cap O == before
            Sex and Vex -> splitscreen
            ctlr-w-w -> move between spilts
            Ex Explore - netrv fileexplorer
            = , =ap - Auto indent

                
        v i w  -> word
        v i W  -> allToNextWhiteSpace
        v i P  -> paragraph
        v i {  -> []{}"' all between 			


        vim -d file file  -  Diff

	flipp buffer terminal
	Write-Output "`e[?1049h";
	Write-Output "`e[?1049l";
        

blast from the past