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
| // | |
| // 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
| // License: MIT Open Source | |
| // Copyright (c) Joe Linoff 2016 | |
| // Go code to prompt for password using only standard packages by utilizing syscall.ForkExec() and syscall.Wait4(). | |
| // Correctly resets terminal echo after ^C interrupts. | |
| package main | |
| import ( | |
| "bufio" | |
| "fmt" | |
| "os" |
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 | |
| # | |
| # Run a command at the specific time with a resolution of 1 second. | |
| # The precision is within 1ms of the time stamp. | |
| # This can be used to do concurrency tests. | |
| # | |
| # There are two input formats: | |
| # | |
| # HH:MM:SS - Run the command at this specific time. | |
| # |
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
| // study format statements | |
| import static java.lang.System.out; | |
| import java.text.DateFormat; | |
| import java.text.SimpleDateFormat; | |
| import java.util.function.BiConsumer; | |
| import java.util.Date; |
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 example demonstrates how to use go to walk a directory | |
| // and filter the contents by using filepath.Walk with | |
| // variables in the external scope to provide the filter and | |
| // to capture the file names. | |
| // | |
| // To build: | |
| // go build walk.go | |
| // Usage: | |
| // walk <pattern> <files> | |
| // |