Skip to content

Instantly share code, notes, and snippets.

View mwallner's full-sized avatar
🧙

Manfred Wallner mwallner

🧙
View GitHub Profile
@mwallner
mwallner / chocostat.ps1
Created October 25, 2018 14:23
Choco Package Status 1-Liner
$(cup all -r -noop) | % { $p = $_.split("|"); New-Object -TypeName psobject -Property @{ name = $p[0]; vcurr = $p[1]; vlatest = $p[2]; pinned = $p[3] }}
$ErrorActionPreference = "Stop"
function Out-EnvValues($valName, $txt) {
$envVarMachine = [Environment]::GetEnvironmentVariable($valName, 'Machine')
$envVarUser = [Environment]::GetEnvironmentVariable($valName, 'User')
$envVar = Get-Content env:$valName
Write-Output "-------------------------------------------"
Write-Output "Out-EnvValues: variable '$valName' $txt"
Write-Output "machine: '$envVarMachine'"
@mwallner
mwallner / Get-NewPrereleasePackageVersion.ps1
Last active November 7, 2018 14:22
fetch the version of a choco package and "increment" it by adding a prerelease tag
param(
[Parameter(Mandatory = $True)]
[string] $id,
[Parameter(Mandatory = $False)]
[string ]$sources
)
$scriptName = $MyInvocation.MyCommand.Name
Write-Verbose "$scriptName / id: $id / sources: $sources"
@mwallner
mwallner / Stop-ProcessWithTimeoutAndWarning.ps1
Created November 21, 2018 15:42
stops a process after some timeout and warning messages
function Stop-ProcessWithTimeoutAndWarning {
param(
# name of process to stop
[Parameter(Mandatory = $True)]
[string]$Name,
# timeout (in seconds) to wait before killing process
[Parameter(Mandatory = $False)]
[int]$Timeout = 30
)
@mwallner
mwallner / choco_search_pre
Last active December 4, 2018 14:42
chocolatey search --pre not working as expected
PS D:\> choco search chocolateygui -r --pre
chocolateygui|0.14.1.0
PS D:\> choco search chocolateygui -r --pre -a
chocolateygui|0.14.2.0-beta
chocolateygui|0.14.1.0
chocolateygui|0.14.0.9
chocolateygui|0.14.0.2
PS D:\> choco search chocolateygui -r -a
$ErrorActionPreference = "Stop"
$scriptBlk = {
Write-Output "this is some output"
Start-Sleep 5
Write-Output "yup, yup"
}
$jobs = @()
$jobs += Start-Job $scriptBlk
function PrintJobWithData {
param(
[Parameter(Mandatory = $True, ValueFromPipeline = $True)]
$job
)
if ($job.HasMoreData -eq "True") {
Write-Output "--- BEGIN $($job.Name) BEGIN ---"
try {
$job | Receive-Job
@mwallner
mwallner / RobotArm.c
Created December 22, 2018 15:54
RobotArm
#include "RobotARM.h"
#include "../../tick.h"
#include "../../BrickPi.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <termios.h>
#include <pthread.h>
@mwallner
mwallner / Get-CurrentlyPrereleasedPackages.ps1
Last active January 15, 2019 08:43
get list of all currently prereleased chocolatey packages for given feeds
$feeds = @(
"https://myorg.feeds/nuget/choco-dev",
"https://myorg.feeds/nuget/choco-prA",
"https://myorg.feeds/nuget/choco-prB"
)
$pkgs = @()
$prereleaseVersionRegex = [regex]"(?'ver'\d+\.\d+(\.\d+(\.\d+)?)?)\-"
$feeds | ForEach-Object {

Keybase proof

I hereby claim:

  • I am mwallner on github.
  • I am schusterfredl (https://keybase.io/schusterfredl) on keybase.
  • I have a public key ASBnJ0YHSv0R8lqvTRYiaaBiN2dvIJb2Xb1Odf6RUMVufwo

To claim this, I am signing this object: