Skip to content

Instantly share code, notes, and snippets.

@meoso
meoso / RequiresReboot.ps1
Created June 28, 2017 13:04
Powershell function to determine if machine requires reboot.
<#
Powershell function to determine if machine requires reboot.
by Michael Simmons : http://ilovepowershell.com/2015/09/10/how-to-check-if-a-server-needs-a-reboot/
Adapted from https://gist.github.com/altrive/5329377
Based on <http://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542>
#>
function Test-PendingReboot
{
if (Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -EA Ignore) { return $true }
if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -EA Ignore) { return $true }
@meoso
meoso / awesomeview.sh
Created June 15, 2017 20:35
AwesomeView.sh - Largest Folders and Files - Found this script online somewhere and modified it slightly
#!/bin/sh
if [ "$1" = "" ] ; then
folder=$(pwd)
else
folder=$1
fi
echo ""
date
@meoso
meoso / shift_state.c
Last active February 3, 2020 04:28
linux keyboard return shift-key pressed state
#include <sys/ioctl.h>
#include <asm/ioctls.h>
#include <stdio.h>
#include <fcntl.h>
// code by "dma" via https://forums.gentoo.org/viewtopic-p-2455159.html#2455159
int main(int argc, char *argv[]) {
int fd;
char shift_state;
@meoso
meoso / gitstatus.sh
Last active June 15, 2017 20:32
ghetto bash-prompt git-status
# append your ~/.bashrc to include
# PROMPT_COMMAND=~/path/to/gitstatus.sh
# skip a line irregardless
echo
echo $'\e[7m' $(date +"%b %d; %H:%M:%S")' '$'\e[m' #date in reverse color
# only run if in a git repo root
if [[ -e .git ]] ; then
#if you dont want to see modified files, uncomment pipe to head
@meoso
meoso / start_minecraft_server.sh
Created April 26, 2017 15:11
minecraft (spigotmc) server start script (run inside gnu screen)
#!/bin/bash
# edit username
username='username' #because i autostart in init.d, i dont want to execute as root
cd ~/minecraft/server || exit 1
case $1 in
"1.10")
server="spigot-1.10.jar";;
@meoso
meoso / pull-all-gits.sh
Last active April 24, 2017 12:49
"git pull" all sub .gits for a given path
#!/bin/bash
#######################################################
# purpose : "git pull" all sub .gits for a given path
# author : njd
# created : 2015-03-05
# modified : 2017-04-21
# usage : ./pull-all-gits.sh [path]
#######################################################
ESC="\033"
@meoso
meoso / all-git-status.sh
Last active April 26, 2017 15:17
show git status for all local repos found under given path
#!/bin/bash
######################################################################
# purpose : show git status for all local repos found under given path
# author : njd
# created : 2017-Apr-21
# usage : ./all-git-status.sh [path] [| less -r]
######################################################################
ESC="\033"
NORMAL="$ESC[m"
@meoso
meoso / myUNMAP.ps1
Last active July 6, 2017 13:14
VMWare SAN SSD UNMAP script
[CmdletBinding()]
param(
[Parameter(Mandatory=$True,Position=0,HelpMessage="vCenter Server")]
[string]$vCenter
)
# Also Accepts "-Verbose" Flag
Write-Host "UNMAPping all volumes on: $vCenter"
Import-Module VMware.VimAutomation.Core | Out-Null
@meoso
meoso / .ElementaryOS.md
Last active February 3, 2020 04:28
base setup for converting Windows user to ElementaryOS Loki release

For converting Windows users to Linux, I'd choose ElementaryOS for it's simplicty and ubuntu base.

Firstly changing min,max,& close window-manager icons to traditional right-side positioning.

Install Firefox and LibreOffice.

Modify launch bar for standard apps.

See attached shell commands.

named bind9 logging configs