Skip to content

Instantly share code, notes, and snippets.

View JamesCalleja's full-sized avatar

James_Calleja JamesCalleja

View GitHub Profile
/*
Wirten by James Calleja
32/11/2017
*/
function rot13(str)
{
var strArray = str.split("");
var result = [];
for (var i = 0; i < str.length; i++)
{
cd Cert:\LocalMachine\My\
$mypwd = cat Microsoft.PowerShell.Core\FileSystem::\\rplan\netlogon\Logon\pwd.txt | ConvertTo-SecureString -key (1..16)
Import-PfxCertificate -Exportable:$false -Password $mypwd -FilePath '\\rplan\netlogon\Logon\star.dev.rplani.co.uk.pfx' -Confirm:$false
@JamesCalleja
JamesCalleja / Delete-UnattachedVolumes.ps1
Last active September 13, 2016 10:26
Delete-UnattachedVolumes
#delets all volumes not attached to a running instance
$volumes = Get-EC2Volume
for ($i = 0; $i -ne $volumes.Length; $i ++) {if ($volumes[$i].state -eq 'available') {Remove-EC2Volume -VolumeId $volumes[$i].volumeID -Force; write-host 'Deleting volume:' $volumes[$i].volumeID }}
@JamesCalleja
JamesCalleja / New-AWSInstance.ps1
Last active September 9, 2016 15:17
AWS build new EC2 instance, add disks,
#search for all images owened by <user> select for *web*
$aim_web = Get-EC2Image -Owner 399828342872 | ?{$_.name -like '*web*'}
#create an EBSBlockDevice profile
$volume1 = New-Object Amazon.EC2.Model.EbsBlockDevice
$volume1.DeleteOnTermination = $true
$volume1.Encrypted = $true
$volume1.VolumeSize = 30
$volume1.VolumeType = 'standard'
@JamesCalleja
JamesCalleja / Set logon hours for AD users across the forest.txt
Last active July 1, 2016 10:17
Set logon hours for AD users across the forest
#########################################################
#Writen by James Calleja
#Date 22/06/2016
#########################################################
# create a byte array for the M-F 8:00 am to 8 pm logon hours
$hours = New-Object byte[] 21
$hours[0] = 0;#sunday 00:00 - 08:00
$hours[1] = 0;# 08:00 - 16:00
@JamesCalleja
JamesCalleja / Citrix Store Front Base Disk Refresh.ps1
Last active July 15, 2016 14:00
Citrix storefront base disk refesh
#Written by: James Calleja #
#Date: 15/07/2016 #
# #
#This script will connect to vcentre, clone from the Golden_Base_Image, and push it to the #
#environment selected via cirtix #
################################################################################################
#load powershell modules and snapins
add-pssnapin vmware.vimautomation.core -EA SilentlyContinue -WarningAction SilentlyContinue
Add-PSSnapin citrix* -EA SilentlyContinue -WarningAction SilentlyContinue
##########################################################################################
#Written By James Calleja #
#20/05/2016 #
# #
#this scrip will migrate a host from one vsphere to another or from cluster to cluster in#
#the same vSphere #
##########################################################################################
$nl = [Environment]::NewLine
#get creds for the operation & the source Vcentre
@JamesCalleja
JamesCalleja / Get all AD computers from all child domains.ps1
Created March 29, 2016 10:58
Full list of computer in the forest
##Run from top level domain to get a full list of computer in the forest, excluding the top level domain (just run get-adcomputer for them)
(get-addomain).childdomains | %{(Get-ADDomainController -Discover -Domain $_).hostname} | %{Get-ADComputer -Filter * -Server $_ -properties * | select name,dnshostname, enabled, distinguishedname,LastLogOnDate }
/**
* helpers.c
*
* Computer Science 50
* Problem Set 3
*
* Helper functions for Problem Set 3.
*/
#include <cs50.h>
@JamesCalleja
JamesCalleja / vigenere.c
Last active September 29, 2016 13:01
vigenere.c
/*####################################
#vigenere.c #
#Written by James Calleja, 2016 #
# #
#Encrypts a string of text by a #
#cypher word provided by the user #
######################################
#include <stdio.h>