Skip to content

Instantly share code, notes, and snippets.

View Ashex's full-sized avatar

Evelyn Osman Ashex

View GitHub Profile
@Ashex
Ashex / install_sql2014.ps1
Last active August 29, 2015 14:21
Silently install SQL Server 2014 from iso
mkdir c:\temp
Write-Host("Install Hotfix to allow .Net 3.5 installation")
Invoke-WebRequest http://download.microsoft.com/download/8/0/8/80894270-D665-4E7A-8A2C-814373FC25C1/NDPFixit-KB3005628-X64.exe -OutFile c:\temp\NDPFixit-KB3005628-X64.exe
Start-Process "c:\temp\NDPFixit-KB3005628-X64.exe" -NoNewWindow -Wait
Write-Host("Enabling .NET Framework 3.5")
Import-Module ServerManager
Add-WindowsFeature Net-Framework-Core
Copy c:\vagrant\en_sql_server_2014_standard_edition_x64_dvd_3932034.iso c:\temp\
@Ashex
Ashex / install_dotnet.py
Created May 20, 2015 12:14
Install .NET 4
def regsearch(regpath):
r = wmi.Registry ()
result, names = r.EnumKey (
hDefKey=_winreg.HKEY_LOCAL_MACHINE,
sSubKeyName="SOFTWARE\Microsoft\NET Framework Setup\NDP"
)
return names
''' Confirm that .Net4 and the required security patch are installed
This is a really crappy check, we're pulling a list of .NET versions
@Ashex
Ashex / checkvisa.sh
Created June 25, 2015 18:15
Check if German Visa is ready
#!/bin/bash
check=`curl -s --data "zapnummer=$1&pbAbfragen=Auskunft" https://www10.muenchen.de/EATWebSearch/Auskunft`
if echo $check | egrep -q "liegt noch nicht zur Abholung bereit" ; then
logger -s "Blue Card for $2 is Not Ready yet"
elif echo $check | egrep -q "green" ; then
/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier -title "Blue Card" -subtitle "Check Status" -message "The Blue Card for $2 is ready!"
fi
@Ashex
Ashex / get_computerinfo.vbs
Created June 25, 2015 18:16
Get hardware details of windows machines
' -----------------------------------------------------------------
' Syntax: cscript collectsysteminfo.vbs file
' Author: Ahmed Osman
' Date: September 14, 2011
' Description:
' Supply the script with a list of DNS machine names and it will retrieve basic system details
'------------------------------------------------------------------
Option Explicit
@Ashex
Ashex / Checkulimit
Created July 2, 2015 15:12
Check ulimit of process
for pid in `pidof nginx`; do echo "$(< /proc/$pid/cmdline)"; egrep 'files|Limit' /proc/$pid/limits; echo "Currently open files: $(ls -1 /proc/$pid/fd | wc -l)"; echo; done
@Ashex
Ashex / eip_failover.sh
Last active August 12, 2021 13:45
EIP failover
#!/bin/sh
# This script will monitor another HA node and take over an Elastic IP (EIP)
# if communication with the other node fails
# Based off the failover scenario and script available here:
# https://aws.amazon.com/articles/2127188135977316
# High Availability IP variables
# Other node's IP to ping and EIP to swap if other node goes down
HA_Node_IP=
EIP=
@Ashex
Ashex / region.py
Last active August 29, 2015 14:26
Accepts a yaml file containing a list of regions as an argument and does stuff with each.
#!/usr/bin/env python
import argparse, yaml
def region(regiondict):
for i in regiondict:
print(i)
@Ashex
Ashex / IAM_policy_vpc.py
Created August 20, 2015 15:32
Dynamic VPC restriction for IAM policy
policy_condition = Join("", ["arn:aws:ec2:", Ref("AWS::AccountId"), ":vpc/" ,Ref(VPC)])
t.add_resource(
Role(
"natEc2Role",
Path="/",
AssumeRolePolicyDocument=
{ "Statement": [ {
"Effect": "Allow",
"Principal": { "Service": [ "ec2.amazonaws.com" ] },
@Ashex
Ashex / accountid_boto3.py
Created October 13, 2015 16:10
Get Account ID from boto3 via IAM or Role ARN
import boto3
import argparse
def main():
argparser = argparse.ArgumentParser(description='Testing ARN stuff')
argparser.add_argument("--role", help="If running with a role provide it here", required=True)
argparser.add_argument("--profile", help="Credential profile", required=True)
argparser.add_argument('--region', help='AWS Region to work within, defaults to eu-central-1', default='eu-central-1', required=False)
args = argparser.parse_args()
role = args.role
@Ashex
Ashex / add_peering_route.py
Created January 27, 2016 16:59
Add Peering connection to AWS Route Tables
__author__ = 'ahmed'
import boto3, botocore
import argparse
def get_vpcid(sitename, client):
response = client.describe_vpcs(
Filters = [{
'Name': 'tag:Site',
'Values': [