Skip to content

Instantly share code, notes, and snippets.

View ZeroBugBounce's full-sized avatar

Richard Lowe ZeroBugBounce

View GitHub Profile
@ZeroBugBounce
ZeroBugBounce / Find-Listeners.psh
Created September 10, 2014 15:12
Powershell: find listeners for a port
netstat -aon | where-object {$_ -like '*2222*'}
@ZeroBugBounce
ZeroBugBounce / findNameIn.js
Last active August 29, 2015 14:11
Find a property name in a JavaScript object tree
function findNameIn(obj, searchFor, ignoreCase, findPartial, parentPath, searched) {
var searchedObjects;
if(!searched) {
searchedObjects = [obj];
}
else {
searchedObjects = searched;
}
@ZeroBugBounce
ZeroBugBounce / feat.sh
Created December 18, 2014 17:33
Create a feature branch from current branch with descriptive name
feat() {
git checkout develop
git pull
git checkout -b feature/DEB-"${@// /-}"
}
@ZeroBugBounce
ZeroBugBounce / bash_profile_keepOurs.sh
Created June 26, 2015 20:57
Bash function to eliminate all changes from a --no-commit merge; to produce an empty merge commit
# this is like saying "I made a bunch of changes in my release branch and I want to merge them to develop
# so that NOTHING CHANGES IN DEVELOP and so that no futher attempts to merge release branch to develop
# will every try to merge them" If there's an easier way to do this, let me nkow.
keepOurs() {
echo reset files deleted by only them
git status --porcelain | grep ^UD | cut -c 4- | xargs git reset
echo reset any new files
git status --porcelain | grep ^A | cut -c 4- | xargs git reset
@ZeroBugBounce
ZeroBugBounce / my-git-log.sh
Last active October 22, 2015 15:57
Various git log techniques
# This shows the git log in a color-coded one line format, excludes merge commits
# and omits (grep -v) commits that mention 'chef'. It also places line numbers
# in front of the commits that are listed, for squashing on HEAD~# purposes.
gitlog() {
(git log -${@-20} --pretty=format:'%C(yellow)%h%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --no-merges | grep -v 'chef') | awk '{printf("%3d %s\n", NR, $0)}'
}