Skip to content

Instantly share code, notes, and snippets.

View edt11x's full-sized avatar

Edward Thompson edt11x

View GitHub Profile
@edt11x
edt11x / deleteShallowFileCopies.pl
Last active January 12, 2019 19:27
A Perl version of the script to delete shallow file copies with more options.
#!/usr/bin/env perl
use strict;
use warnings;
use Digest::SHA qw(sha1_base64 sha256_base64 sha512_base64);
use File::Basename;
use File::Find ();
use Getopt::Long;
use IO::All;
@edt11x
edt11x / runaptgetupdate
Created January 27, 2018 23:51
runaptgetupdate - script to update my Debian system
#!/bin/bash
# Need bash instead of just /bin/sh
#
###############################################################################
#
# Debian has multiple different, non-overlapping, mechanisms to update the
# current version. I like to run Debian Sid, the unstable rolling version. One
# of the dangers is that dependencies for big packages like gnome, can easily
# get broken or worse, uninstalled. This is a script I have that tries hard to
# do many of the possible ways to update/upgrade and tries to load the set of
@edt11x
edt11x / runbrewupdate
Created January 27, 2018 23:36
runbrewupdate - my script to update all my homebrew packages
brew update
brew upgrade
brew install arp-scan
brew install ent
brew install fdupes
brew install global
brew install gpg
brew install macvim
brew install oath-toolkit
brew install par2
@edt11x
edt11x / findprimes.py
Last active January 13, 2018 18:38
Find Primes
import time
print('Find Primes')
listOfPrimes = []
checkList = [ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199 ]
startTime = time.clock()
i = 3
while i < 1000000: # test every odd number, there is only one even prime
isprime = True
for thisPrime in listOfPrimes:
if ((thisPrime * thisPrime) <= i) and ((int(i/thisPrime)*thisPrime) == i):
@edt11x
edt11x / deleteShallowFileCopies.sh
Last active January 27, 2018 23:34
Find and delete shallow copies of files
#!/bin/bash
die() {
set +x
echo >&2 "$@"
usage
exit 1
}
function usage {
set +x
@edt11x
edt11x / randInRange
Created June 4, 2017 18:49
Shell script to give a random integer in a range
#!/usr/bin/env perl
print ($ARGV[0] + int(rand($ARGV[1] - $ARGV[0])))
@edt11x
edt11x / ArchiveDirectory.cmd
Last active November 6, 2017 02:15
ArchiveDirectory.cmd - a Windows versions of my archivedirectory shell script
@echo off
TITLE ArchiveAllDirectories
@rem I am not very good at DOS Batch / Command files, so there are probably a lot
@rem more comments in the script than people would normally expect, and possibly
@rem a lot more mistakes.
@rem Setlocal EnableDelayedExpansion is needed for this and probably most batch and
@rem command files. Normally the variables are set when the script is read, not when
#!/usr/bin/env perl
# generate an 8 x 8 password grid
use String::Random;
use strict;
use warnings;
# some characters are hard to distinguish when written
# or in certain typefaces. I am going to ignore
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long;
# my @set = ('0' .. '9', 'A' .. 'Z', 'a' .. 'z');
# non ambiguous characters
# https://ux.stackexchange.com/questions/21076/are-there-numbers-and-letters-to-avoid-for-activation-codes-via-sms
my @set = split //,'abcdefghkmnoprstwxzABCDEFGHJKLMNPQRTWXY34689';
@edt11x
edt11x / archivedirectory
Last active November 6, 2017 02:17
Archive files or directories in a way that works pretty well across Mac, Linux and Windows
#!/bin/bash
# bail out on any failure, we do not want a bad archive
set -e
die() {
set +x
echo >&2 "$@"
usage
exit 1
}