Skip to content

Instantly share code, notes, and snippets.

@grese
grese / whoping.py
Last active October 1, 2020 23:57
Scapy - who ping?
#! /usr/bin/python3
"""
whoping?
Shows a desktop notification using 'notify-send' (or executes
a custom command) when ICMP packets are received on the specified
interface. Also, saves the received packets to a pcap file if desired.
Usage:
@grese
grese / git-prompt-setup.sh
Last active October 9, 2019 05:42
Automatic git bash prompt setup for MacOS
#!/bin/bash
#=======================================
# git-prompt-setup.sh
#
# Adds git branch to your bash prompt.
#=======================================
GITPROMPT_DIR=~/.bin
GITPROMPT_FILE=git-prompt.sh
@grese
grese / iframe_sandbox.jsx
Created June 12, 2016 10:08
A ReactJS component for rendering other React components into a "src-less" iframe
var Sandboxr = React.createClass({
componentDidMount() {
const iframe = this.refs.frame;
const node = iframe.contentDocument.createElement('div');
iframe.contentDocument.body.appendChild(node);
this._contentNode = node;
this._renderChildrenIntoContentNode(this.props);
},
@grese
grese / iframe-embed.js
Last active December 4, 2015 20:04
Dynamic iFrame Embed
function embedHTMLContent(markup, container) {
// generate a new HTML document, and an iFrame...
var newDoc = document.implementation.createHTMLDocument('sample flickr content'),
iFrame = document.createElement('iframe'),
destDoc, srcNode, newNode;
// Style the empty iframe, and insert it into the DOM...
iFrame.width = '400px';
@grese
grese / closureMath.js
Last active August 29, 2015 14:18
A script that creates functions for operators and operands, which can be used to perform basic math operations.
/*
* Creates functions for the numbers 0-9, and also functions for +, -, *, and /.
* Here is a list of the available functions:
* Operands: zero(), one(), two(), three(), four(), five(), six(), seven(), eight(), nine();
* Operators: plus(), minus(), times(), divide();
*
* Usage:
* The Operands ('zero' through 'nine') can be called with or without an operator as an argument.
*
* The Operators ('plus', 'minus', etc..) require that a number be passed as a param, and must be executed within an Operand.