Skip to content

Instantly share code, notes, and snippets.

View vrthra's full-sized avatar

Rahul Gopinath vrthra

View GitHub Profile
3 http://mynews.com/query?a=b,c=d#fragment
protocol:'http' host:'mynews.c' port:-1 file:None path:'/om/query' query:'a=' ref:',c=d#fragment'
'h' != 'u'
'h' != 'a'
'h' != 'b'
'h' != 'c'
'h' != 'd'
'h' != 'e'
'h' != 'f'
'h' != 'g'
@vrthra
vrthra / details
Created September 2, 2018 12:38
review pages
~/.home/man/man0/gopinath2017on.0 -- set MANSECT=$MANSECT:0 and MANPATH=$MANPATH:~/.home/man/
@vrthra
vrthra / jupyter.py
Created November 5, 2018 16:50
jupyter-disable-autoclose
# Run this in Python once, it should take effect permanently
from notebook.services.config import ConfigManager
c = ConfigManager()
c.update('notebook', {"CodeCell": {"cm_config": {"autoCloseBrackets": False}}})

Rehabilitating Mutant Immortals.

One often hears the claim that mutation analysis is unreliable because of the presence of immortal (equivalent) mutants. The problem is that the true mutation score is the ratio between the number of mutants killed and the actual number of mortal mutants. Since there is no general algorithm to determine all immortal mutants from a set of mutants, it is impossible to determine the actual number of mortal mutants from an arbitrary set of mutants. Hence, the mutation score is unreliable as a measure of test suite quality, which is the primary purpose of mutation testing.

Further, live mutants are often used by practitioners to determine how to enhance their test cases so that it covers more specification by killing them. Immortal mutants, by definition can not help here because they can not be killed. Hence, human effort spent on analyzing these mutants is often considered a waste.

Useful Immortal Patterns

Our thesis is that one needs to consider the issue from a more ho

@vrthra
vrthra / gll.py
Created December 9, 2018 11:51 — forked from cheery/gll.py
GLL recognizer/parser
# A GLL recognizer with a twist.
# The parser builds up a list of reduction rules when it is parsing.
# Once sorted, the list can be used to build parse trees.
class GSS(object):
def __init__(self, label, index=0):
self.label = label
self.index = index
self.edges = set()
self.nodes = {}
@vrthra
vrthra / post-commit
Last active April 9, 2019 14:30
A post-commit hook to backup your generated binary files.
#!/usr/bin/env python
# Author: Rahul Gopinath <rahul@gopinath.org>
# LICENSE : GPLv3
# DESC: This post-commit hook enables one to save generated files
# seprately from the main repository.
# REQUIREMENTS:
# * Place this file as .git/hooks/post-commit (without the extension)
# and make sure it is executable `chmod +x .git/hooks/post-commit`
# * Define your backup dir as environment variable `BACKUP_DIR` i.e
# `export BACKUP_DIR=~/my_backups`
@vrthra
vrthra / GhidraDecompiler.java
Created April 11, 2019 11:53 — forked from guedou/GhidraDecompiler.java
Call the Ghidra decompiler from the command line
// Copyright (C) 2019 Guillaume Valadon <guillaume@valadon.net>
// This program is published under a GPLv2 license
/*
* Decompile a function with Ghidra
*
* analyzeHeadless . Test.gpr -import $BINARY_NAME -postScript GhidraDecompiler.java $FUNCTION_ADDRESS -deleteProject -noanalysis
*
*/
@vrthra
vrthra / html_grammar.py
Last active May 27, 2019 15:14
grammars
import string
import fuzzingbook
from fuzzingbook import GrammarFuzzer
HTML_GRAMMAR = {
'<start>': ['<_l_>!DOCTYPE html<_r_><html_document>'],
'<_l_>': ['<'],
'<_r_>': ['>'],
'<_cl_>': ['</'],
'<a_tag>': ['<_l_>a<d><_r_><a_content>*<_cl_>a<_r_>'],
import string
import tinycss
import fuzzingbook
from fuzzingbook import GrammarFuzzer
import string
CSS_GRAMMAR = {
'<start>': ['<stylesheet>'],
'<stylesheet>': ['<[CHARSET_SYM_STRING_SEMI]>? <[S_OR_CDO_OR_CDC]>* <[import_CDO_S_OR_CDC_S]>* <[stylesheet_closing_GROUPING]>*'],
@vrthra
vrthra / cf_parser.py
Created August 5, 2019 13:59
Context free parser
import heapq
class Exp:
def __init__(self, rule, text, at):
self.rule, self.text, self.at, self.expanded = rule, text, at, 0
def __lt__(self, o): return self.expanded < o.expanded
def __gt__(self, o): return self.expanded > o.expanded
def __eq__(self, o): return self.expanded == o.expanded
def __repr__(self):