Skip to content

Instantly share code, notes, and snippets.

View mostafahussein's full-sized avatar
💀
K3rn3l Cr4sh3r

(╯°□°)╯︵ uᴉǝssnH ɐɟɐʇsoW mostafahussein

💀
K3rn3l Cr4sh3r
View GitHub Profile
@mostafahussein
mostafahussein / tcp_returner.py
Created September 13, 2016 22:41 — forked from ryancurrah/tcp_returner.py
SaltStack State Event TCP Returner Module
# -*- coding: utf-8 -*-
'''
Returns state event data for state.sls and state.highstate execution only using a tcp socket, this method of
returning data can be used for Splunk or ELK.
Each event sent represents a single state executed.
It is strongly recommended to use the ``event_return_whitelist`` so not all
events call this returner, for example:
@mostafahussein
mostafahussein / map-nginx-cookie
Created July 17, 2016 03:41 — forked from caquino/map-nginx-cookie
Avoid NGINX caching based on cookies
@mostafahussein
mostafahussein / subdomain-localhost-rails-5.md
Created June 5, 2016 23:57 — forked from indiesquidge/subdomain-localhost-rails-5.md
how to access subdomains locally with Rails 5

Subdomaining Localhost with Rails 5

I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api

Rails.application.routes.draw do
  constraints subdomain: "api" do
    scope module: "api" do
@mostafahussein
mostafahussein / go-install.md
Created May 14, 2016 11:49 — forked from diegopacheco/go-install.md
How to Install GO Lang on CentOS / Amazon Linux?

How to Install GO Lang on CentOS / Amazon Linux?

sudo wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz
tar -xzf go1.4.2.linux-amd64.tar.gz 
export GOROOT=PATH_WHERE_YOU_EXTRACT_GO
export PATH=$PATH:$GOROOT/bin 
export GOBIN=$GOROOT/bin 
mkdir ~/golang/ 
export GOPATH=~/golang/ 
@mostafahussein
mostafahussein / gist:b9688a433e8149ec1cb6bf90f82e5f80
Created May 8, 2016 09:14 — forked from sirleech/gist:2660189
Python Read JSON from HTTP Request of URL
# Load Json into a Python object
import urllib2
import json
req = urllib2.Request("http://localhost:81/sensors/temperature.json")
opener = urllib2.build_opener()
f = opener.open(req)
json = json.loads(f.read())
print json
print json['unit']
https://github.com/atom/atom/releases/download/v1.6.0/atom-windows.zip
https://notepad-plus-plus.org/repository/6.x/6.9/npp.6.9.Installer.exe
@mostafahussein
mostafahussein / gist:aa6e2968d8ff86ea77c7
Created March 8, 2016 13:52 — forked from callmephilip/gist:3443827
[Python Fabric] passing arguments to a task
def new_user(username, admin='no', comment="No comment provided"):
log_action("New User (%s): %s" % (username, comment))
pass
$ fab new_user:myusername
$ fab new_user:username=myusername
$ fab new_user:myusername,yes
$ fab new_user:myusername,admin=yes
$ fab new_user:myusername,admin=no,comment='Gary\, new developer (starts Monday)'
rpm -Uvh http://www.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-1-12.rhel6.noarch.rpm
@mostafahussein
mostafahussein / xmlrpc-distributed-brute-defense.conf
Created February 11, 2016 16:55 — forked from alzabo/xmlrpc-distributed-brute-defense.conf
WP/xmlrpc brute force ModSecurity rules
# These rules are designed to be effective versus /distributed/ brute force
# attacks. While they will function just as well against attacks which are
# /not distributed/ they will deny access to all XML-RPC method calls
# namespaced with the prefix "wp."
#
# An IP-based version of these rules may be more appropriate for sites which
# attacked from just a few distinct IP addresses.
#
# See http://alzabo.io/modsecurity/2014/09/15/wordpress-xml-rpc-brute-force.html
# for additional information
@mostafahussein
mostafahussein / testChainedPromise.js
Created January 7, 2016 18:34 — forked from calendee/testChainedPromise.js
A simple example of chained promises using Q promise library.
var Q = require("q");
var slowFunction1 = function( myObject ) {
console.log("\nRunning slowFunction1");
console.log(myObject);
var deferred = Q.defer();
setTimeout( function() {