Skip to content

Instantly share code, notes, and snippets.

View shitchell's full-sized avatar

Shaun Mitchell shitchell

View GitHub Profile
@shitchell
shitchell / pysock
Created July 7, 2020 01:35
Python script resembling ncat that allows you to send invisible characters using their unicode values
#!/usr/bin/env python3
import sys
import time
import socket
import _thread
import readline
if len(sys.argv) < 3:
print('usage: pysock [options] server port')
@shitchell
shitchell / dupes
Created July 7, 2020 01:06
Python script to scan directories / files for duplicates and optionally remove them
#!/usr/bin/env python3
import re
import os
import sys
import time
import hashlib
import optparse
parser = optparse.OptionParser()
@shitchell
shitchell / bak
Created July 7, 2020 01:04
Easily create backups of files with a .bak extension (also adds a trailing number if the file already exists)
#!/bin/bash
for filepath in $@; do
if [[ -f "$filepath" ]]; then
filepath_bak=$filepath.bak
if [[ -f "$filepath_bak" ]]; then
i=1
filepath_bak_i=$filepath_bak".$i"
while [[ -f "$filepath_bak_i" ]]; do
((i++))
@shitchell
shitchell / github-clone
Last active July 7, 2020 01:00
Clone a github repository with just the username and repository name: github-clone shitchell qrng
#!/bin/bash
usage() {
echo "usage: $(basename $0) github-user github-repository"
echo " $(basename $0) github-user/github-repository"
}
if [[ "$#" -ne 1 && "$#" -ne 2 ]]; then # require exactly 1 or 2 arguments
usage && exit
elif [[ "$#" -eq 1 && "$1" != *"/"* ]]; then # if one argument provided, require a slash