Skip to content

Instantly share code, notes, and snippets.

View marklap's full-sized avatar

Mark LaPerriere marklap

View GitHub Profile
{
"info": {
"_postman_id": "c4fe8106-d044-491f-9799-2ab19c0919d9",
"name": "C-Project",
"description": "C-Project example use.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Tail Log File",
@marklap
marklap / peekable_generator.py
Created July 11, 2023 21:45
An implementation of a generator that detects when the last item has been consumed.
#!/usr/bin/env python
################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2023 Mark LaPerriere
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#!/usr/bin/env python
################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2021 Mark LaPerriere
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#!/usr/bin/env python
################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2021 Mark LaPerriere
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@marklap
marklap / jumble_case.py
Last active March 10, 2021 16:07
Jumble the case of a string
#!/usr/bin/env python
################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2021 Mark LaPerriere
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@marklap
marklap / sqrt.py
Last active May 9, 2018 18:35
little fun creating a square root function
#!/usr/bin/env python
################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2018 Mark LaPerriere
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@marklap
marklap / __init__.py
Created May 6, 2018 05:32
longest palindromic substring
''' longest_palindromic_substring package '''
@marklap
marklap / __init__.py
Last active May 6, 2018 05:19
Implementation of atoi
''' atoi package '''
@marklap
marklap / daily_max_traffic_client.py
Last active April 13, 2018 05:45
Daily Max Bytes Sent to Client IP
''' daily_max_traffic_client reads the log file provided on the command line and reports
the IP address of the client with the most traffic delivered for each day of the current month
##################################################################################
Given the example logfile, implement code that will report what was the ip address that consumed the most traffic for every day in the current month?
# ip, timestamp, path, status code, size
10.1.1.1,19-06-2005:06:44:17 +0200,"GET index.html HTTP/1.1",200,12468
10.1.1.2,19-06-2005:06:46:05 +0200,"GET index.html HTTP/1.1",200,12468
10.1.1.1,19-06-2005:06:47:37 +0200,"GET about.html HTTP/1.1",200,3456
@marklap
marklap / progress_bar.go
Last active April 4, 2018 00:20
Toy CLI progress bar (thread safe) - experiment in using bits as placeholders for the indicator so we can do bitwise operations to shift the spinner left and right instead of mucking with string magic.
////////////////////////////////////////////////////////////////////////////////
// The MIT License (MIT)
//
// Copyright (c) 2018 Mark LaPerriere
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is