Skip to content

Instantly share code, notes, and snippets.

View infogulch's full-sized avatar

Joe Taber infogulch

View GitHub Profile
@infogulch
infogulch / README.md
Last active September 16, 2023 13:47 — forked from alimbada/Export-Chocolatey.ps1
Export installed Chocolatey packages as packages.config - thanks to Matty666

Put update.ps1, install.ps1, record.ps1, and packages.config inside a git repository to enable tracking which versions you have installed at any one time. This means you can sync between systems and backup via any git host.

Update procedure is:

git pull
./update.ps1
git commit -m "Updated $env:computername"

git push

@infogulch
infogulch / RegionGetColor.ahk
Created May 13, 2020 17:50
RegionGetColor - AutoHotkey script c.2008 that uses a raw x86 machine code accelerated kernel to sum the rgb components of a pixel buffer in order to find the average color of a portion of the screen
;RegionGetColor.ahk
;#############################################################
regionGetColor(x, y, w, h, hwnd=0) {
; created by Infogulch - thanks to Titan for much of this
; x, y, w, h ~ coordinates of the region to average
; hwnd ~ handle to the window that coords refers to
DllCall("QueryPerformanceCounter", "Int64 *", Start1)
regionGetBmp(bmp, dc, obj, x, y, w, h, hwnd)
@infogulch
infogulch / utf8.cpp
Created December 6, 2018 03:49
UTF-8 Decoder in Mill assembly
// decode accepts a byte and a vector of the next 3 bytes (the %first byte and the possible
// %continuation bytes and returns a decoded code point in an integer, and the number of bytes
// consumed (including the first byte) The vector may contain NaR bytes if at the end of a buffer
F('decode') %first, %cont;
// fast path for 1 byte
con(v(0xe0, 0xf0, 0xf8)) %prefmask, //R0 # masks of the three possible prefixes
lssu(%first, 0x80) %onebyte, // E0 # check if the first byte is < 0x80
andlu(%first, %prefmask) %masked, // E1 # bit-and with bitmasks of 3 possible prefixes
retntr(%onebyte, %first, 1); // F0# if < 0x80 return the first byte & consume one byte
@infogulch
infogulch / multisort.go
Last active May 6, 2016 23:59
How to design a Go slice type that needs to be sortable in many ways.
// How to design a Go slice type that needs to be sortable in many ways.
package main
import (
"fmt"
"sort"
)
type data struct {
i int
@infogulch
infogulch / blah.go
Last active September 22, 2015 20:57
Test file for /clipperhouse/gen/pull/65
package main
@infogulch
infogulch / README.md
Last active December 11, 2015 22:08
high level generic C type modules

#How to compile Type make

@infogulch
infogulch / gist:4057353
Created November 12, 2012 03:34
Tee class
cls := new TeeClasses(MyClass, MyOtherClass)
inst := new cls()
inst.MyMethod("a","b") ; this calls MyMethod from *both* classes
class MyClass
{
MyMethod(arg1, arg2)
{
msgbox % A_ThisFunc " called with: " arg1 ", " arg2
table t1 contains 4 rows, with id = 1, 2, 3, 5
SELECT X, Y
FROM (
SELECT A.id as X, (SELECT MIN(b.id) FROM t1 AS B WHERE B.id > A.id) as Y
FROM t1 AS B
) C
WHERE Y IS NOT NULL
id1 | id2
# Copyright (c) Mathias Kaerlev 2011-2012.
# This file is part of pyspades.
# pyspades is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# pyspades is distributed in the hope that it will be useful,
# Copyright (c) Mathias Kaerlev 2011-2012.
# This file is part of pyspades.
# pyspades is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# pyspades is distributed in the hope that it will be useful,