This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Print help if it was requested. | |
if [[ $1 == "-h" || $1 == "-?" ]]; then | |
printf "quarantine_days - Provide a date in the format of YYYY/MM/DD\n" | |
printf "\tIf the date is valid, the number of days in quarantine will be printed.\n" | |
printf "\tNon-valid dates will cause the script to exit.\n" | |
exit | |
fi | |
# Make sure something was passed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TimeZone.setDefault(TimeZone.getTimeZone('UTC')) | |
Integer year = Calendar.getInstance().get(Calendar.YEAR) | |
Integer month = Calendar.getInstance().get(Calendar.MONTH) | |
def then = new GregorianCalendar(year, month, 1, 0, 0, 0).time | |
// Desired format: 2020-06-01T00:00:00.000000+00:00 | |
thenISO = then.format("yyyy-MM-dd'T'HH:mm:ss.SSSZ", TimeZone.getTimeZone("UTC")) | |
thenISOFixed = thenISO[0..thenISO.length() - 3] + ":00" | |
println thenISOFixed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var size = 15, base = ""; | |
for(var i = 1; i <= size; i++) { | |
if(i % 2 === 1) { | |
for(var k = 1; k <= size; k++) { | |
if(k % 2 === 1) { | |
base += "#"; | |
} else { | |
base += " "; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
usage_tracker = {} | |
report_file = "./pstn_report.csv" | |
with open(report_file, "r", newline="") as csvfile: | |
reader = csv.DictReader(csvfile) | |
for row in reader: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the objects with the required attributes and storing proxyAddresses properly in the .csv file. | |
Get-ADObject -Filter { objectClass -eq "contact" } -Server myserver.mydomain.net -SearchBase "OU=Contacts,DC=mydomain,DC=net" -SearchScope OneLevel -Properties name,givenName,sn,displayName,telephoneNumber,proxyAddresses,targetAddress,mail,mailNickname,company,department,l,physicalDeliveryOfficeName,postalCode,st,streetAddress,title | Select-Object name,givenName,sn,displayName,telephoneNumber,targetAddress,mail,mailNickname,company,department,l,physicalDeliveryOfficeName,postalCode,st,streetAddress,title,@{name="proxyAddresses"; expression={$_.proxyAddresses -join ";"}} | Export-Csv -Path .\sample.csv -Encoding ASCII -Append -NoClobber -NoTypeInformation | |
# Shows how to then use the proxyAddresses attribute in the future. | |
$allContacts = Import-Csv -Path .\sample.csv | |
foreach($singleContact in $allContacts) { | |
$proxyAddresses = $singleContact.proxyAddresses.Split(";") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Number { | |
[int] $value = 0 | |
Number() { | |
#Does nothing. | |
} | |
Number([int]$somethingElse) { | |
$this.value = $somethingElse | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Reddit Daily Programmer #260 - Easy | |
//https://www.reddit.com/r/dailyprogrammer/comments/4cb7eh/20160328_challenge_260_easy_garage_door_opener/ | |
using System; | |
namespace DoorOpener | |
{ | |
class DoorOpener | |
{ | |
//Create an enumerated set for my sanity in figuring the state of the door. | |
enum DoorState { open, closed, opening, closing, stoppedOpening, stoppedClosing, emergencyOpening, openBlocked }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://www.reddit.com/r/dailyprogrammer/comments/46zm8m/20160222_challenge_255_easy_playing_with_light/ | |
#Function for flipping the switches. | |
function FlipSwitch ($Array,$Position) | |
{ | |
$currentBoolean = $Array[$Position] | |
if($currentBoolean) | |
{ | |
$newValue = $false | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Making a class for where state employees go for lunch. This does NOT account for holidays affecting when you get paid. | |
class StateEmployee | |
{ | |
#Base properties. | |
[string] $firstName = "" | |
[string] $lastName = "" | |
[bool] $payDay = $false | |
#Default empty constructor. Seriously, don't use this. | |
StateEmployee() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Dim objShell | |
set objShell = CreateObject("WScript.Shell") | |
While true | |
objShell.AppActivate("powershell") | |
objShell.SendKeys "{Up}" | |
WScript.Sleep 200 | |
objShell.SendKeys "{Enter}" | |
WScript.Sleep 5000 | |
Wend |
NewerOlder