tiistai 30. huhtikuuta 2024

Google Project Zero

Fascinating site, should follow more.


 https://googleprojectzero.blogspot.com/2024/04/the-windows-registry-adventure-1.html

https://googleprojectzero.blogspot.com/2024/04/the-windows-registry-adventure-2.html

perjantai 16. kesäkuuta 2023

Bookmarking this, https://makingmoneyblog01.blogspot.com/2023/06/how-do-i-install-windows-1xx.html


perjantai 17. toukokuuta 2019

lauantai 6. huhtikuuta 2019

One timewasting sieve more: The Go version

Studied Go (or Golang) for work, and of course wanted to gauge its performance. Here is a port of the sieve benchmark.

// Sieve benchmark in Go, based on the Java code at
// http://rsb.info.nih.gov/nih-image/java/benchmarks/Sieve.java

package main

import (
    "time"
    "math"
    "strconv"
)

func main () {
    const SIZE = 8190
    // For "similarness" with other versions, allocate dynamically
    var flags []bool = make([]bool, SIZE+1)
    var i, prime, k, count int
    var iterations int = 0
    var seconds float64
    var score int = 0
    var startTime time.Time
    var elapsedTime time.Duration = 0
    var tenSeconds time.Duration
    tenSeconds, _ = time.ParseDuration("10s")

    startTime = time.Now();
    for elapsedTime < tenSeconds {
        count=0;
        for i=0; i<=SIZE; i++ {
            flags[i]=true;
        }
        for i=0; i<=SIZE; i++ {
            if flags[i] {
                prime=i+i+3
                for k=i+prime; k<=SIZE; k+=prime {
                    flags[k]=false
                }
                count++
            }
        }
        iterations++
        elapsedTime = time.Now().Sub(startTime)
    }
    seconds = elapsedTime.Seconds()
    score = int(math.Round(float64(iterations) / seconds))
    println(strconv.Itoa(iterations) + " iterations in " +
        strconv.FormatFloat(seconds, 'g', -1, 64) + " seconds")
    if count != 1899 {
        println("Error: count <> 1899")
    } else {
        println("Sieve score = " + strconv.Itoa(score))
    }
}

keskiviikko 28. kesäkuuta 2017

curses

Fascinating, Ubuntu requires me to install libncurses5-dev to compile a curses-using program (Nethack). I wonder why so un-intuitive name.