Skip to content

Instantly share code, notes, and snippets.

View schittli's full-sized avatar

Tom-- schittli

  • Biel / Bienne, Switzerland
  • 15:57 (UTC +02:00)
View GitHub Profile
@Jaykul
Jaykul / TestModule.Wtf.ps1
Last active April 8, 2018 02:28
I seem to be having some scope problems
Get-Module -Name ModuleMockExample | Remove-Module
New-Module ModuleMockExample {
function Hidden { "This is Hidden!" }
function Get-Hidden { Hidden }
function Get-GetHidden { Get-Hidden }
function Private { Write-Output "This was private" }
function Get-Public { Write-Output "This was public" }
function Get-Private { Private }
@poizan42
poizan42 / MoveAnyFile.ps1
Created November 24, 2017 13:37
PowerShell script for moving / renaming files with otherwise invalid filenames
param([String]$existingFilename, [String]$newFilename)
$signature = @'
[DllImport("kernel32.dll", ExactSpelling=true, CharSet=CharSet.Unicode, SetLastError=true)]
public static extern uint MoveFileW(
string lpExistingFileName, string lpNewFileName);
'@
$type = $null
try
@NominaceTacitus
NominaceTacitus / powercfg-win10-more-settings.cmd
Last active August 3, 2024 19:07 — forked from theultramage/powercfg-win7-all-settings.bat
Show/hide hidden settings in Win10 Power Options
@echo on
REM checked for Windows 10
REM fork from https://gist.github.com/theultramage/cbdfdbb733d4a5b7d2669a6255b4b94b
REM you may want full list https://gist.github.com/raspi/203aef3694e34fefebf772c78c37ec2c
REM SET attrib=+ATTRIB_HIDE
SET attrib=-ATTRIB_HIDE
REM Hard disk burst ignore time
powercfg -attributes 0012ee47-9041-4b5d-9b77-535fba8b1442 80e3c60e-bb94-4ad8-bbe0-0d3195efc663 %attrib%
@Cerothen
Cerothen / AdvancedWindowSnap.ahk
Last active April 2, 2022 03:36 — forked from AWMooreCO/AdvancedWindowSnap.ahk
Advanced Window Snap is a script for AutoHotKey that expands upon Windows built-in window-snapping hotkeys.
/**
* Advanced Window Snap (Extended
* Snaps the Active Window to one of nine different window positions.
*
* @Editing author Jarrett Urech
* @Original author Andrew Moore <[email protected]>
* @version 2.1
*
**/
@Jaykul
Jaykul / Get-DependencyTree.ps1
Last active September 1, 2022 14:38
Print a module dependency tree for modules
filter Get-DependencyTree {
<#
.NOTES
From https://gist.github.com/Jaykul/304e7874d629ef4848c9acd0cfd550d0
#>
param(
[Parameter(Mandatory, ValueFromPipeline)]
[System.Management.Automation.PSModuleInfo[]]$Module,
$Depth = 0,
@Jaykul
Jaykul / Trace-Dependency.ps1
Last active October 6, 2022 09:38
Extract a list of commands used by a script or script command. Will warn about commands it can't identify and put them in global `$MissingCommands` variable.
#requires -Module Reflection
[CmdletBinding()]
param(
# The path to a script or name of a command
$Command,
# If you want to include private functions from a module, make sure it's imported, and pass the ModuleInfo here
[System.Management.Automation.PSModuleInfo]$ModuleScope = $(
Get-Module $Command -ListAvailable -ErrorAction SilentlyContinue | Get-Module -ErrorAction SilentlyContinue
),
# Allows overriding the default paths where Configuration stores it's configuration
# Within those folders, the module assumes a "powershell" folder and creates per-module configuration folders
PathOverride = @{
# Where the user's personal configuration settings go.
# Highest presedence, overrides all other settings.
# Defaults to $Env:LocalAppData on Windows
# Defaults to $Env:XDG_CONFIG_HOME elsewhere ($HOME/.config/)
UserData = ""
# On some systems there are "roaming" user configuration stored in the user's profile. Overrides machine configuration
# Defaults to $Env:AppData on Windows
@sgaulding
sgaulding / own.dg.theme
Last active October 6, 2023 11:09
SmartGit Dark Theme (SmartGit Version 17.1)
# This file lists the color values of the default dark theme.
# Each line starting with a # is a comment.
# To overwrite certain colors remove the leading # and change the color values.
# The "extends" line defines which color definitions to use if none is found here.
extends=deepgit-dark-theme.properties
# The "preferredEditorTheme" line determines what editor theme should be used by default ('light' or 'dark').
preferredEditorTheme=dark
const Ffmpeg = require(‘fluent-ffmpeg’);
const STREAM_URL = ‘http://icecast.radio24.ch/radio24-rc-96-aac';
const VOLUME_THRESHOLD = -50; // volume threshold
getMeanVolume(STREAM_URL, function(meanVolume){
if(meanVolume <= VOLUME_THRESHOLD){
console.log(“WE HAVE A PROBLEM! VOLUME IS TOO LOW!”);
}else{
console.log(‘ALL GOOD!’);
}
<#
.SYNOPSIS
Get Weather of a City
.DESCRIPTION
Fetches Weather report of a City from website - http://wttr.in/ courtsey Igor Chubin [Twitter- @igor_chubin]
.PARAMETER City
Name of City