Skip to content

Instantly share code, notes, and snippets.

@arberg
arberg / logger.ps1
Created September 19, 2019 14:39 — forked from barsv/logger.ps1
Logging in powershell with log rotation
# all logging settins are here on top
$logFile = "log-$(gc env:computername).log"
$logLevel = "DEBUG" # ("DEBUG","INFO","WARN","ERROR","FATAL")
$logSize = 1mb # 30kb
$logCount = 10
# end of settings
function Write-Log-Line ($line) {
Add-Content $logFile -Value $Line
Write-Host $Line
@arberg
arberg / logger.ps1
Created September 19, 2019 14:39 — forked from barsv/logger.ps1
Logging in powershell with log rotation
# all logging settins are here on top
$logFile = "log-$(gc env:computername).log"
$logLevel = "DEBUG" # ("DEBUG","INFO","WARN","ERROR","FATAL")
$logSize = 1mb # 30kb
$logCount = 10
# end of settings
function Write-Log-Line ($line) {
Add-Content $logFile -Value $Line
Write-Host $Line
@arberg
arberg / Get-TodoistBackup.ps1
Last active June 11, 2018 19:21 — forked from dansmith65/Get-TodoistBackup.ps1
Powershell script to download the latest backup from Todoist - With logging and win10 notifications on failure
# Get-TodoistBackup.ps1
# Created By: Daniel Smith dan@dansmith65.com
#
# Download the latest backup from Todoist
#
# https://gist.github.com/dansmith65/7a753ddb89c9db145d41b0c4b3c7fac0
# https://gist.github.com/arberg/5c905272dd3ba41d767e0907b46cd675
# Powershell Notifications: Install-Module -Name BurntToast
$useToast=(Get-Command New-BurntToastNotification -errorAction SilentlyContinue)
@arberg
arberg / Apache Tomcat 8 Start stop script init.d script
Last active October 17, 2018 18:12 — forked from miglen/Apache Tomcat 8 Start stop script init.d script
Apache Tomcat init script (or startup/controll script). Works fine for version 7/8. Read the comments for release history. Feel free to modify, copy and give suggestions. (c) GNU General Public License
#!/bin/bash
#
# description: Apache Tomcat init script
# processname: tomcat
# chkconfig: 234 20 80
#
#
# Copyright (C) 2014 Miglen Evlogiev
#
# This program is free software: you can redistribute it and/or modify it under