Skip to content

Instantly share code, notes, and snippets.

Ian Gallagher craSH

Block or report user

Report or block craSH

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@craSH
craSH / tc_to_kml.py
Created Mar 14, 2017
tripcreator-manipulator
View tc_to_kml.py
#!/usr/bin/env python
"""
Parse a TripCreator JSON file and emit a KML file.
Example: https://widgets.tripcreator.com/gas-stations-prices-iceland-map/tripcreator-gas-prices-iceland.json
Taken from the widget on this page: http://luxeadventuretraveler.com/tips-for-driving-icelands-ring-road-winter/
Copyleft 2017 Ian Gallagher <crash@neg9.org>
"""
import json
import os
@craSH
craSH / init-tunnels.sh
Last active Jun 3, 2016
Script to setup multiple SSH tunnels in a reliable way for use with FoxyProxy or other SOCKS-aware clients
View init-tunnels.sh
#!/usr/bin/env bash
#
# Use to setup numerous various tunnels to SSH servers, useful with ssh config blocks like those below
# for each host, with incrementing port numbers for each - then configure FoxyProxy etc to use the unique
# port for each host you want to tunnel out of.
#
# Thanks to tecknicaltom <tecknicaltom@neg9.org> for the initial idea behind tying this all together.
#
# Host host_alpha
# IdentityFile ~/.ssh/id_ecdsa-$USER-host_alpha-<remote_hostname>-<key_gen_year>-<key_gen_month>
@craSH
craSH / extract_offsets.py
Created Sep 3, 2015
Extract chunks between chunk sizes at a given list of offsets. Handy when combined with the output of hachoir-subfile for ELF images in a filesystem, for example.
View extract_offsets.py
#!/usr/bin/env python
"""
Extract chunks between chunk sizes at a given list of offsets.
Handy when combined with the output of hachoir-subfile for ELF images in a filesystem, for example.
Copyleft 2015 Ian Gallagher <crash@neg9.org>
"""
import sys
import os
import logging
@craSH
craSH / indexcode
Last active Aug 29, 2015
Index code with glimpse, ctags, and cscope. Store the indexes and such in a defined cache directory, which may live on a fast SSD
View indexcode
#!/usr/bin/env bash
# Original credit to tecknicaltom@neg9.org for creating this script and concept - thanks!
# Store indexes and such in a cache located on an SSD, and symlink to them
# Ensure the cache location is at the same or better security level (encrypted drive) as the data you are indexing.
cache_root="${HOME}/.indexcodecache"
cur_proj="$(basename -a ${PWD} | tr -d '\n')-$(echo ${PWD} | shasum -a 512 | cut -c 1-16)"
cache_dir="${cache_root}/${cur_proj}"
# Set umask to create files as mode 0600 (user r/w, go none)
View ssh-keygen-remove-all
#!/usr/bin/env bash
function ssh-keygen-remove-all() {
if [ -n $1 ]; then
ssh-keygen -R "$1" >/dev/null 2>&1 && \
echo "Removed complete hostname: $1"
simple_host=$(echo $1 | cut -d '.' -f1)
if [ -n "$simple_host" ]; then
ssh-keygen -R "$simple_host" >/dev/null 2>&1 && \
@craSH
craSH / natstrings.py
Last active Aug 29, 2015
Like strings(1) but only return stuff that is probably english (or whatever locale you set)
View natstrings.py
#!/usr/bin/env python
"""
Like strings(1) but only return stuff that is probably English (or whatever locale you set)
TODO:
* Add a parameter to ignore punctuation as token counts towards the threshold.
e.g. "Foo." vs "Foo........" would both return true.
* Add conditional for not counting digit only results if alphanumeric=True in is_natlang()
* Unicode support - currently it doesn't work with unicode, quite bad for non-english input
@craSH
craSH / diceware.py
Last active Apr 28, 2017
Select easy to use passphrases based on the diceware list; but not their selection methodology [lazy]
View diceware.py
#!/usr/bin/env python
"""
Select easy to use passphrases based on the diceware list; but not their selection methodology [lazy].
Place the diceware and beale wordlists (GPG signed is fine) in /usr/share/dict before use.
* Diceware list: http://world.std.com/~reinhold/diceware.wordlist.asc
* Alternative Beale list: http://world.std.com/~reinhold/beale.wordlist.asc
* EFF List (Large): https://www.eff.org/files/2016/07/18/eff_large_wordlist.txt
* EFF List (Small): https://www.eff.org/files/2016/09/08/eff_short_wordlist_1.txt
@craSH
craSH / keybase.md
Last active Aug 29, 2015
I have updated my PGP key, and am updating my keybase proof.
View keybase.md

Keybase proof

I hereby claim:

  • I am crash on github.
  • I am crash (https://keybase.io/crash) on keybase.
  • I have a public key whose fingerprint is F887 3E31 2041 DF5E A3E6 2D3F AFD0 1F0B 7F26 52C4

To claim this, I am signing this object:

@craSH
craSH / ssh-mkkey
Last active Jan 4, 2018
Handy helper script to generate new SSH keys in a predictable format, provide the needed ssh_config stanza to use them, and automatically upload them to the remote server.
View ssh-mkkey
#!/usr/bin/env bash
#
# Handy helper script to generate new SSH keys in a predictable format,
# provide the needed ssh_config stanza to use them, and automatically
# upload them to the remote server.
#
# Copyleft 2014 Ian Gallagher <crash@neg9.org>
if [ -z "$1" ]; then
echo "Usage: $0 <remote_host> [key_type] [key_size]" >&2
View Generate_Expression.py
###########################################################
# This srcipt will simply produce expressions to be #
# used with config.py #
# - Disclaimer - I'm not responsible for how you use this #
# this was created for personal usage and for educational #
# purposes #
# CopyLeft Jason Tsang Mui Chung (tsangtmc@gmail.com) #
###########################################################
brute_list = raw_input("Enter the string you would like to generate a expression for:")
length = len(brute_list)
You can’t perform that action at this time.