Skip to content

Instantly share code, notes, and snippets.

View EricZimmerman's full-sized avatar
🤡

Eric EricZimmerman

🤡
View GitHub Profile
@EricZimmerman
EricZimmerman / frequencytester.md
Last active December 23, 2023 23:46 — forked from kmobs/frequencytester.md
Frequency Tester

Frequency Testing

This will allow you to test a specific frequency that you hear when you do your resonance testing in Klipper and potentially track down where extra peaks are coming from. If something is rattling at a specific frequency, you can specify that frequency and feel around the printer until you track it down.

Code was adopted by zifnab from somewhere in Klipper.

Usage

You have to have [resonance_holder] in your printer.cfg.

The command is HOLD_RESONANCE AXIS=<axis> FREQ=int SECONDS=<seconds>

@EricZimmerman
EricZimmerman / FindFiles_EnumerateFiles
Created January 23, 2022 18:16
.net 6 multipattern file find with ignore list and minimum size
static IEnumerable<string> FindFiles(string directory, IEnumerable<string> masks, HashSet<string> ignoreMasks, EnumerationOptions options,long minimumSize = 0)
{
foreach (var file in masks.AsParallel().SelectMany(searchPattern => Directory.EnumerateFiles(directory, searchPattern, options)))
{
var fi = new FileInfo(file);
if (fi.Length < minimumSize)
{
Log.Debug("Skipping {File} with size {Length:N0}",file,fi.Length);
continue;
}
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\powerlevel10k_rainbow.omp.json" | Invoke-Expression
Import-Module -Name Terminal-Icons
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -PredictionSource history
@EricZimmerman
EricZimmerman / gitps.txt
Created August 4, 2019 20:54
Update all git repos under a dir in powershell
Get-ChildItem -Directory | foreach { Write-Host "`n■ Getting latest for $_ ↓" | git -C $_.FullName pull -v}
@EricZimmerman
EricZimmerman / Base64_PS.txt
Last active February 14, 2018 23:09
Base64 PS
cGFyYW0gKCRDb21wdXRlck5hbWUgPSAiLiIsICRGaWxlUGF0aCA9lCIuXEFwcGxpY2F0aW9uc0ludmVudG9yeS5jc3YiKQ0KDQpnZXQtd21pb2JqZWN0lC1xdWVyeSAiU0VMRUNUlCogRlJPTSBXaW4zMl9Qcm9kdWN0liAtY29tcHV0ZXJuYW1lICRDb21wdXRlck5hbWUgfCANCnNvcnQtb2JqZWN0lFZlbmRvciB8lA0Kc2VsZWN0LW9iamVjdCBQU0NvbXB1dGVyTmFtZSxWZW5kb3IsTmFtZSxWZXJzaW9uLENhcHRpb24sRGVzY3JpcHRpb24sSW5zdGFsbERhdGUsSW5zdGFsbExvY2F0aW9uLEluc3RhbGxTb3VyY2UsUGFja2FnZU5hbWUgfA0KZXhwb3J0LWNzdiAtcGF0aCAkRmlsZVBhdGggLWFwcGVuZCA=
Set-PSReadlineKeyHandler -Key Tab -Function Complete
copy this to clipboard
PS1="\[\033[32m\][\w]\[\033[0m\]\n\[\033[1;36m\]\u\[\033[1;33m\]-> \[\033[0m\]"
in bash shell, type (note the space at the end)
export
and then copy the string from above after it, like this:
@EricZimmerman
EricZimmerman / Win10PrefechDecompress.cs
Last active June 14, 2016 11:13
pinvoke for RtlDecompressBufferEx in c#
using System.Runtime.InteropServices;
namespace Prefetch.XpressStream
{
public class Xpress2
{
// const ushort COMPRESSION_FORMAT_LZNT1 = 2;
// const ushort COMPRESSION_FORMAT_XPRESS = 3;
const ushort CompressionFormatXpressHuff = 4;
@EricZimmerman
EricZimmerman / w10pfdecomp.py
Last active July 4, 2023 09:48 — forked from dfirfpi/w10pfdecomp.py
Windows 10 Prefetch (native) Decompress
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015, Francesco "dfirfpi" Picasso <francesco.picasso@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@EricZimmerman
EricZimmerman / stub.cs
Created July 22, 2015 12:43
Check for .net 4.6 or greater
private static bool CheckForDotnet46()
{
using (RegistryKey ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full\\"))
{
int releaseKey = Convert.ToInt32(ndpKey.GetValue("Release"));
return (releaseKey >= 393295);
}
}