Skip to content

Instantly share code, notes, and snippets.

Working from home

Abdallah Deeb abdallah

Working from home
View GitHub Profile
abdallah /
Created Mar 13, 2020
Lambda function to update whitelist with newrelic IPs
import os
import json
import boto3
import urllib3
# Set the following in the Lambda Environment variables
IP_SET_ID = os.environ.get('IP_SET_ID')
Special_IPs = os.environ.get('SPECIAL_IPS').split(',')
abdallah / create-acm-cert.yml
Created Mar 11, 2020
Create an Amazon issued certificate in ACM. Uses Route53 for DNS verification
View create-acm-cert.yml
- hosts: localhost
gather_facts: no
aws_profile: "aws_account_name"
acm_domain: ""
acm_extra_domains: "*"
acm_idempotency_token: "examplecomtoken"
dns_zone: ""
AWS_PROFILE: "{{ aws_profile }}"
abdallah /
Created Mar 8, 2018
Send SNS notifications to Graylog2
import boto3
import json
import requests
from datetime import datetime
import sys
PORT = 12201 # change if you create graylog input with different port
queue_url = ''
abdallah /
Created Feb 28, 2018
Log PID and path of process causing high CPU usage (php-fpm)
# very specific need
top_process=$(ps -eo pid,cmd,%cpu --sort=-%cpu | head -n2 | tail -n1)
if [[ $top_process == *sometest* ]]; then
PATHTOPROCESS=$(echo $top_process| awk '{print $1}' | xargs lsof -p | grep public_html)
logger -it HIGHCPU "Process $top_process in $PATHTOPROCESS"
abdallah / install_nr_infra.yml
Created Nov 30, 2016
Install New Relic Infrastructure agent on all my servers using Ansible playbook (Ubuntu)
View install_nr_infra.yml
- hosts: all
- lineinfile: "dest=/etc/newrelic-infra.yml line='license_key: YOURKEYHERE' create=yes state=present"
- apt_key:
- apt_repository: "repo='deb [arch=amd64] {{ansible_distribution_release}} main' state=present update_cache=yes"
- apt: name=newrelic-infra
abdallah / plugin.php
Created Feb 10, 2016
WordPress ajax skeleton
View plugin.php
Plugin Name: My Plugin
Plugin URI:
Description: 10 ways to peel an orange
if ( ! defined( 'ABSPATH' ) ) {
abdallah / other_languages_switcher.php
Last active Sep 9, 2015
WPML custom switcher to show "other" languages
View other_languages_switcher.php
function other_languages_switcher(){
$languages = icl_get_languages('skip_missing=1');
foreach($languages as $l){
if(!$l['active']) {
$langs[] = '<a href="'.$l['url'].'">'.$l['language_code'].'</a>';
echo join(', ', $langs);
abdallah / 00monit
Last active Aug 29, 2015
Monit configurations
View 00monit
files in /etc/monit/conf.d/
abdallah /
Created Nov 28, 2014
attacker using http 1.0 so that should block them but let everybody else in
iptables -I INPUT 1 -p tcp --dport 80 -m string --string "HTTP/1.0" --algo bm -j DROP
abdallah /
Created Nov 4, 2014
Check SSL for domain if SHA-1 or SHA-256

Suggested usage

Put certificates list in certs.txt and run:

awk '{ print $3 }' certs.txt | while read d; do bash $d 2>/dev/null; done | grep OK