Skip to content

Instantly share code, notes, and snippets.

@gcmurphy
gcmurphy / opendaylight vulnerability process
Last active July 25, 2019 07:15
OpenDaylight Vulnerability Managment
#OpenDaylight - Vulnerability Management
[TOC]
##Motivation
The OpenDaylight project has gained enough momentum and popularity that the responsible management of security issues in the upstream community is warranted. OpenDaylight has in fact had its first [CVE](http://seclists.org/bugtraq/2014/Aug/75) assigned via an independent security researcher, who at the time had no process to follow. This **must** change.
@gcmurphy
gcmurphy / tw.sh
Created August 29, 2014 03:14
simple pingdom replacement
#!/bin/bash
# Check if your site is still up and send you a direct tweet if it isn't
#
# [dependencies]
# libwww-perl
# ruby-gem -> t
#
# [setup]
# mkdir ~/twitter_alerts
# t authorize
@gcmurphy
gcmurphy / keybase.md
Created August 20, 2014 10:24
keybase.md

Keybase proof

I hereby claim:

  • I am gcmurphy on github.
  • I am gmurphy (https://keybase.io/gmurphy) on keybase.
  • I have a public key whose fingerprint is 634C 0EB3 217B 3080 5C9A 0ACB 8362 ECFD 8F22 453B

To claim this, I am signing this object:

@gcmurphy
gcmurphy / mutt.py
Created July 11, 2014 03:16
draft an email using mutt..
def draft_email(**kwargs):
cmd = ["mutt"]
if 'to' in kwargs:
cmd.append(",".join(kwargs.get('to')))
if 'subject' in kwargs:
cmd.append("-s")
cmd.append(kwargs.get('subject'))
@gcmurphy
gcmurphy / edit.py
Created July 11, 2014 02:21
Pops up your $EDITOR and returns the content entered. Similar to 'git commit -a'
def edit_dialog(**kwargs):
EDITOR = os.environ.get("EDITOR", "vim")
with tempfile.NamedTemporaryFile(suffix=".tmp") as tmp:
if 'prefill' in kwargs:
tmp.write(kwargs.get('prefill'))
tmp.flush()
subprocess.call([EDITOR, tmp.name])
output = ""
with open(tmp.name) as message:
@gcmurphy
gcmurphy / scoping.c
Created December 18, 2013 22:35
Things that I didn't know you could do with GNU C
#include <stdio.h>
#include <stdlib.h>
#define nil NULL
#define ScopedFile FILE * __attribute__((cleanup(fclosep)))
#define ScopedMemory void * __attribute__((cleanup(freep)))
void fclosep(FILE **f){
if (*f){
fclose(*f);
@gcmurphy
gcmurphy / child-pom.xml
Created November 9, 2013 05:05
Basic submodule project configuration for victims. Configuration from simple-web example in this book http://books.sonatype.com/mvnex-book/reference/
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>parent</artifactId>
<groupId>org.sonatype.mavenbook.simpleweb</groupId>
<version>0.8-SNAPSHOT</version>
@gcmurphy
gcmurphy / debug_imports.py
Created October 3, 2013 06:03
Tracing all imports
import sys
import __builtin__
real_import = __builtin__.__import__
def debug_import(name, locals=None, globals=None, fromlist=None, level=-1):
glob = globals or sys._getframe(1).f_globals
importer_name = glob and glob.get('__name__') or 'unknown'
print('{} imports {}'.format(importer_name, name))
return real_import(name, locals, globals, fromlist, level)
# save as ~/.pythonstartup.py
# export PYTHONSTARTUP=$HOME/.pythonstartup.py
# (gives you tab completion / history)
import readline
import rlcompleter
import atexit
import os
readline.parse_and_bind('tab: complete')
@gcmurphy
gcmurphy / gist:6217834
Last active February 6, 2017 23:50
Templates for loop unrolling / metaprogramming.
#include <iostream>
#include <cstdint>
template<int i, uint64_t val, typename Function>
class Loop {
public:
static inline void call(Function f){
f(i, val);
Loop<i-1, val, Function>::call(f);
}