Skip to content

Instantly share code, notes, and snippets.

View abdallah's full-sized avatar
🏠
Working from home

Abdallah Deeb abdallah

🏠
Working from home
View GitHub Profile
@abdallah
abdallah / README.md
Created November 4, 2014 16:17
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 check_sha256.sh $d 2>/dev/null; done | grep OK
@abdallah
abdallah / block_http1.0_ddos.sh
Created November 28, 2014 11:14
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
abdallah / 00monit
Last active August 29, 2015 14:18
Monit configurations
files in /etc/monit/conf.d/
@abdallah
abdallah / other_languages_switcher.php
Last active September 9, 2015 11:04
WPML custom switcher to show "other" languages
<?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
abdallah / netstat_count_ips.sh
Created November 7, 2011 08:26
Netstat to to find number of connections from each IP
netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
# found @ http://midnight-cafe.co.uk/linux-commands/netstat-to-find-number-of-connections-from-each-ip/
@abdallah
abdallah / NatGeoWallpaperDownloader.py
Created June 27, 2012 09:10
NatGeo Wallpaper Downloader
#!/usr/bin/python
# NatGeo Wallpaper Downloader
# version: 0.1.2
# author: Abdallah Deeb <abdallah.deeb@gmail.com>
# description: Simply python script to download
# and set the gnome wallpaper from the
# National Geographic "Photo of the day" page
# source: http://photography.nationalgeographic.com/photography/photo-of-the-day/
import urllib2, urllib, os, re
from gi.repository import Gio
@abdallah
abdallah / smtptest.py
Created July 26, 2012 10:21
Simple SMTP tester script
import smtplib
import argparse
import sys
parser = argparse.ArgumentParser(description='SMTP Tester', add_help=True)
parser.add_argument('-s', '--server', dest='server', action='store',
help='Server Name or IP')
parser.add_argument('-u', '--username', dest='username', action='store',
help='username - try with and without the @')
parser.add_argument('-p', '--password', dest='password', action='store',
@abdallah
abdallah / reinstallvps.sh
Created July 26, 2012 10:57
Re-install VPS at RimuHosting
#!/bin/bash
APIKEY=0000000000000000000000000
VPSOID=00000000
VPSNAME=test01.vps
# more info on this per http://apidocs.rimuhosting.com/jaxbdocs/com/rimuhosting/rs/order/OSDPrepUtils.NewVPSRequest.html
# & instantiation_options: http://apidocs.rimuhosting.com/jaxbdocs/com/rimuhosting/rs/order/OSDPrepUtils.InstantiationData.html
create_vps() {
echo Installing ${VPSNAME} ...
curl -X POST \
@abdallah
abdallah / checkmodule.sh
Created July 31, 2012 06:11
Check if a module is compiled in to the kernel
#!/bin/bash
zgrep $1 /proc/config.gz
@abdallah
abdallah / restartvps.sh
Created August 8, 2012 09:36
Reboot RimuHosting VPS
#!/bin/bash
APIKEY=00000000000000000000000000
VPSOID=0000000
VPSNAME=whatever
curl -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: rimuhosting apikey=$APIKEY" -X PUT -d ‘{"reboot_request": {"running_state": "RESTARTING"}}’ https://rimuhosting.com/r/orders/order-$VPSOID-$VPSNAME/vps/running-state