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:3d2b1ad717551f832ae6
Created October 9, 2015 17:53
Flowdock: Tail log and stream to flowdock FLOW
unbuffer tail -f /var/log/log.log | egrep --line-buffered "DEPLOY_SUMMARY" | xargs -I {} /usr/bin/curl -XPOST -H "content-type:application/json" -d '{"content":"{}","external_user_name": "Deploy"}' https://api.flowdock.com/v1/messages/chat/xxxxx
@omar-yassin
omar-yassin / gist:2e55fe201a12aecb12a1
Created October 9, 2015 17:57
Riemann custom config
; pardon syntax - clojure newb
; Custom subject
(def email
(mailer
{
:from "[email protected]"
:host "localhost"
:subject (fn [events] (apply str "RIEMANN DETECTION: " (get-in (first events) [:host]) " TRIGGERED [" (get-in (first events) [:service]) " STATE]: " (get-in (first events) [:state])))
}
@omar-yassin
omar-yassin / gist:413d1a361c0ab9834e8c
Last active October 9, 2015 18:02
Linux: Burn to optical media
#!/bin/bash
# SUDOERS /etc/sudoers.d/lbbackup
# Cmnd_Alias LS_HARDWARE = /usr/bin/lshw
# Cmnd_Alias MOUNT_UDF = /bin/mount -oloop\,rw *
# Cmnd_Alias UNMOUNT_UDF = /bin/umount /data/TEMP_UDF_DIR/MOUNT_UDF
# Cmnd_Alias BURN_UDF = /usr/bin/growisofs
# Cmnd_Alias CHOWN_MOUNT = /bin/chown -R lbbackup\:lbbackup /data/TEMP_UDF_DIR/MOUNT_UDF
# lbbackup ALL=(ALL) NOPASSWD: LS_HARDWARE, MOUNT_UDF, UNMOUNT_UDF, BURN_UDF, CHOWN_MOUNT
@omar-yassin
omar-yassin / gist:06f2436164ad51b6fa0a
Created October 16, 2015 13:21
Powershell Script: retrieve ENV Vars
$script:ComputerName = [Environment]::getenvironmentvariable("COMPUTERNAME")
$script:BootTime = [Environment]::getenvironmentvariable("AWS_BootTime", "Machine")
$script:LaunchTime = [Environment]::getenvironmentvariable("AWS_LaunchTime", "Machine")
$script:DeployTime = [Environment]::getenvironmentvariable("AWS_DeployTime", "Machine")
$script:EnvName = [Environment]::getenvironmentvariable("AWS_EbEnvironmentName", "Machine")
$script:EbAppName = [Environment]::getenvironmentvariable("AWS_EbApplicationName", "Machine")
$script:CDN_STATUS = [Environment]::getenvironmentvariable("CDN_STATUS", "Machine")
@omar-yassin
omar-yassin / gist:c698d73d28aeba261be8
Last active February 7, 2024 17:36
AWS EC2 GET WINDOWS PASSWORD + AUTO RDP
#!/bin/bash
#ASSUMES KeyPairs are stored in ~/.ssh
# Also make sure to install jq and have in your path to run below
# JQ: https://stedolan.github.io/jq/
AWS_BIN="/usr/local/bin/aws"
AWS_PROFILE="omar-dev"
KP_DIR="~/.ssh"
@omar-yassin
omar-yassin / gist:7a02d01b66e98612afaa
Last active December 9, 2015 20:23
Powershell AWS Get-elbtag Example
((get-elbtags -LoadBalancerName ELB-OMAR).Tags | where {$_.key -eq 'tag-name'}).Value
$instance_state = (Get-ELBInstanceHealth -LoadBalancerName $elb_name | where {$_.InstanceId -eq "$instance_id"}).State
#f*ck joo
$deploy_args = @(
"-verb:sync",
"-source:package=$provisioning_dir/$zip_name",
"-dest:auto",
"-setParam:name='IIS Web Application Name',value='omar'"
)
$deploy = Start-Process ${msdeploy_bin} -NoNewWindow -ArgumentList $deploy_args -PassThru -Wait
@omar-yassin
omar-yassin / gist:0efe814cf29be33dfe1772b5e702e0be
Last active April 13, 2016 04:09
Powershell: pretty way to compare if string contains multiple strings
$failed_status_types = 'CREATE_FAILED', 'DELETE_FAILED', 'ROLLBACK_FAILED', 'UPDATE_ROLLBACK_FAILED'
if ($failed_status_types -match "some_string" ) { "si" }
@omar-yassin
omar-yassin / gist:7ae39da34fb6488f9d76b224a3e2593b
Created May 6, 2016 01:58
JQ: Hyphen/-/Special Chars in Keys
Does't work:
jq '.foo.dude-yes'
Works
jq '.foo["dude-yes"]'