Skip to content

Instantly share code, notes, and snippets.

View jcefoli's full-sized avatar

Joe Cefoli jcefoli

View GitHub Profile
@jcefoli
jcefoli / mongocollectioncounteremail.sh
Created January 26, 2016 22:42
Sends An Email With the Number of Documents in a MongoDB Collection
#!/bin/bash
myCollectionCount=`mongo -u user -p password database_name --quiet --eval 'db.getCollection("my_collection").count()'`
echo "my_collection Count: $myCollectionCount > disk.txt
echo >> disk.txt
df /dev/mapper/volume-group >> disk.txt
cat disk.txt | mail -S smtp="smtp.relay.tld:25" -r "From Name<[email protected]>" -s "Email Subject" -v "[email protected]"
rm disk.txt
@jcefoli
jcefoli / dosboxcommandline.bat
Last active February 13, 2018 18:56
DosBox Shortcut (One Click Game Launcher)
"C:\Program Files (x86)\DOSBox-0.74\DOSBox.exe" -c "MOUNT D C:\bin:\DosGames" -c "D:" -c "cd keen5" -c "keen5e" -noconsole
REM |
REM | This mounts the D:\DosGames to the D drive and changes directory to keen6 and launches the keen6c executable with no console
REM |
REM | You can use these parameters in a script or Windows shortcut
@jcefoli
jcefoli / userDefineLang.xml
Created January 28, 2016 16:09
NotePad++ User Defined Parsing for: nginx, golang and puppet manifest files
<NotepadPlus>
<UserLang name="go" ext="go">
<Settings>
<Global caseIgnored="no" />
<TreatAsSymbol comment="no" commentLine="no" />
<Prefix words1="no" words2="no" words3="no" words4="no" />
</Settings>
<KeywordLists>
<Keywords name="Delimiters">&quot;&apos;0&quot;&apos;0</Keywords>
<Keywords name="Folder+" />
@jcefoli
jcefoli / speedbot.py
Created February 1, 2016 07:06
Parse speedtest-cli results
#!/usr/bin/python
import os
import sys
# Simplified version of: http://www.engadget.com/2016/01/31/comcast-customer-complaint-bot/ aka http://pastebin.com/WMEh802V
# Removed the Twitter integration and file system logging
# To do: Add variables and math so the speeds are not hard coded and are based off a percent calculation
def speedbot():
#Run speedtest-cli (pip install speedtest-cli, assumes it's in your system path)
@jcefoli
jcefoli / guid.ps1
Created February 17, 2016 14:45
Create GUID in Powershell (Uppecase String)
[guid]::NewGuid().toString().ToUpper()
@jcefoli
jcefoli / flush_dotnet_temp.cmd
Created February 19, 2016 14:14
Flush .NET Cache
@ECHO OFF
iisreset /stop
ECHO Deleting x86 Temporary ASP.NET Files...
for /d %%i in ("%systemroot%\Microsoft.Net\Framework\v*") do for /d %%f in ("%%i\Temporary ASP.NET Files\*") do RD /q/s "%%f"
ECHO Deleting x64 Temporary ASP.NET Files
for /d %%i in ("%systemroot%\Microsoft.Net\Framework64\v*") do for /d %%f in ("%%i\Temporary ASP.NET Files\*") do RD /q/s "%%f"
@jcefoli
jcefoli / SaveSpotlightImages.ps1
Last active December 30, 2023 18:34
Copies the Windows Spotlight lock screen images in Windows 10 to a "Windows Spotlight" folder in My Pictures.
<#
.DESCRIPTION
Copies the Windows Spotlight lock screen images in Windows 10 to a "Windows Spotlight" folder in My Pictures.
This script will intelligently sort through the temporary directory and will only copy images
that are 1920x1080. Since the filenames of the images can change, the script will also compare
SHA1 hashes of the existing so we don't copy duplicates.
.NOTES
Version: 1.0.2
@jcefoli
jcefoli / centos6domainjoin.md
Last active May 9, 2022 01:37
Join CentOS 6 to Windows Domain

Join CentOS 6 VM to Domain

  1. Install Necessary Packages yum -y install authconfig krb5-workstation pam_krb5 samba-common oddjob-mkhomedir

  2. Set DNS Nameservers to Primary Domain Controller and Secondary View config like this cat /etc/resolv.conf and make sure the nameservers point at the domain controller IPs.

  3. Join Domain This will join the domain. It's multi-line for readability. You can copy/paste the whole thing into the terminal and it will work

@jcefoli
jcefoli / echotable.bat
Created May 8, 2016 07:14
Prints text within a table in a batch file
@ECHO OFF
ECHO ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
ECHO ³ Title Here ³
ECHO ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
ECHO ³ Put all of your text here. It will be shown ³
ECHO ³ in a nice table. ³
ECHO ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
ECHO.
@jcefoli
jcefoli / check_unsigned.ps1
Created July 25, 2016 14:47
Check if Powershell Script is Unsigned, Set it, and Terminate the Script
$Policy = "Unrestricted"
If ((get-ExecutionPolicy) -ne $Policy) {
Write-Host "Script Execution is disabled. Enabling it now"
Set-ExecutionPolicy $Policy -Force
Write-Host "Please Re-Run this script in a new powershell enviroment"
Exit
}