This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| ''' | |
| Simple example of how to use the crypto library for AES encryption and | |
| decryption. | |
| Make sure that the Crypto (pycrypto) module is installed: | |
| $ pip-2.7 install pycrypto | |
| $ pip-3.5 install pycrypto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Function to measure and report progress. | |
| # A bit like PV but for general things like copying N files. | |
| # Use it as a starting point to created your own. | |
| # | |
| # License: MIT Open Source | |
| # Copyright (c) 2016 Joe Linoff | |
| # Show the progress of N items with an estimate of the time remaining. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # This image will fix all of the partitions in a disk image. | |
| # | |
| # Usage: | |
| # fix-image.sh test.img | |
| # | |
| # License: MIT Open Source | |
| # Copyright (c) 2016 by Joe Linoff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| ''' | |
| Report the first caller that is not part of the Foo class. | |
| Tested in Python 2.7.11, 3.4 and 3.5. | |
| License: MIT Open Source | |
| Copyright (c) 2016 Joe Linoff | |
| ''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This code example shows how to use java 8 streams to quickly | |
| // determine primes in a range. It is NOT production code. It | |
| // is only for reference. | |
| // MIT License | |
| // Copyright (c) 2016 - Joe Linoff | |
| import java.time.Duration; | |
| import java.time.Instant; | |
| import java.util.ArrayList; | |
| import java.util.List; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| ''' | |
| Add thousands separator to the integer portion of a string of digits. | |
| It will handle a leading minus sign and a fraction. | |
| Examples: | |
| 1234 --> 1,234 | |
| -1234 --> -1,234 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.jlinoff; | |
| import java.util.Date; | |
| import java.text.DateFormat; | |
| import java.text.SimpleDateFormat; | |
| import java.util.logging.*; | |
| /** | |
| * Test logging. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| This class implements a CLI tool that does run time class introspection | |
| using reflection. It is similar to javap. See the help (-h) for more details. | |
| MIT License. | |
| Copyright (c) 2016 Joe Linoff | |
| Permission is hereby granted, free of charge, to any person obtaining | |
| a copy of this software and associated documentation files (the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // This simple program accepts linux commands from the command line and | |
| // executes them using the exec package. | |
| // | |
| // The one tricky thing about this is that Go does not provide any way to | |
| // tokenize the command strings because that process is shell dependent. | |
| // | |
| // The lexer I have written is pretty dumb but it works for most common | |
| // use cases. | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Program to diff to files to find mismatches using the | |
| // longest common subsequence (LCS) algorithm. | |
| // See the help (-h) for more information. | |
| // To build it: | |
| // $ go build -o lcsdiff lcsdiff.go lcsdiff_options.go | |
| /* | |
| License: The MIT License (MIT) | |
| Copyright (c) 2016 Joe Linoff |
OlderNewer