Skip to content

Instantly share code, notes, and snippets.

View omar-yassin's full-sized avatar

Omar Yassin omar-yassin

View GitHub Profile
@omar-yassin
omar-yassin / gist:9937810
Created April 2, 2014 16:37
Validating Email SPF/DKIM for GAPPS
validate score of email via:
http://www.mail-tester.com/
email [email protected] (will send email report)
validate SPF synatx with:
http://www.kitterman.com/spf/validate.html?
gapps validator:
https://toolbox.googleapps.com/apps/checkmx/
@omar-yassin
omar-yassin / dns_spf_expander.sh
Last active October 28, 2019 19:35
DNS SPF Expander (MAX LOOKUP should not exceed 10 lookups)
#!/bin/bash
#TO RUN
# > ./dns_spf_expander.sh domain.com
lookup_count=0
function spf_expand {
for spf in $1 ; do
if echo $spf | grep "include:" > /dev/null 2>&1 ; then
((lookup_count++))
@omar-yassin
omar-yassin / gist:9961949
Created April 3, 2014 20:11
GIT clone from local file repo
git clone --no-hardlinks path/to/file.git
cat json.file | python -m json.tool | less
export PS1='\e[1;35m\u\e[m@\h:\e[1;31m\w\e[m\n\$ '
@omar-yassin
omar-yassin / gist:666bdf8ef137b1a64d36
Created July 8, 2014 20:25
Namecheap: Dynamic DNS
python:
# -*- coding: utf-8 -*-
import urllib2
urllib2.urlopen("https://dynamicdns.park-your-domain.com/update?host=%s&domain=%s&password=%s" % ("SUBDOMAIN", "DOMAIN", "namecheap.dynamicDNS.PASSWORD"))
@omar-yassin
omar-yassin / gist:2e480f12057eb8cdd52f
Created October 3, 2014 14:30
BASH: error catching pipes
tar ... | ssh ...
pipe_exit_status="${PIPESTATUS[@]}"
tar_status=`echo $pipe_exit_status | awk '{print $1}'`
ssh_status=`echo $pipe_exit_status | awk '{print $2}'`
@omar-yassin
omar-yassin / gist:97b281bb13ce74747f43
Last active August 29, 2015 14:08
awk-ing CSV with quotes with delimiter
gawk -vFPAT='[^,]*|"[^"]*"' '{print $1,$2,$3}'
@omar-yassin
omar-yassin / gist:f25b5a17f0f7084eecfd
Created April 30, 2015 14:11
AWS EC2 Powershell Cheatlist
$EC2_launch_time = Get-Date (Get-EC2Instance -Instance $instanceId | % { $_.RunningInstance } | Select-Object -expand LaunchTime) -format "M/d/yyyy hh:mm:ss tt"
$Windows_bootTime = Get-Date (Get-CimInstance -ClassName win32_operatingsystem | select -expand lastbootuptime).tostring().trim() -format "M/d/yyyy hh:mm:ss tt"
@omar-yassin
omar-yassin / gist:37d08da804da6e7c7787
Created May 6, 2015 15:15
Powershell: Install Patches Example
# This script will first install the "PSWindowsUpdate" PS Module and then install KBs we specify in this script
# KB_ID Description
# KB3042553 MS15-034 Critical: Vulnerability in HTTP.sys Could Allow Remote Code Execution - https://technet.microsoft.com/en-us/library/security/ms15-034.aspx
# TO DO make it more robust where we can pass kb articles by hash and loop check
$kb_to_patch="KB3042553"
$ps_windows_update_zip="C:\Windows\temp\PSWindowsUpdate.zip"
$ps_modules_dir="C:\Windows\System32\WindowsPowerShell\v1.0\Modules"