This file contains 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
// Daniel Lemire in this article | |
// https://lemire.me/blog/2013/12/26/fastest-way-to-compute-the-greatest-common-divisor/ | |
// presented benchmark comparisons of different implementations of Stein's (binary) gcd algorithm. | |
// The wikipedia (iterative) implementation of the algorithm was noted to be very inefficient. | |
// Lemire presented benchmarked comparisons of various implementations, original code below. | |
// https://github.com/lemire/Code-used-on-Daniel-Lemire-s-blog/blob/master/2013/12/26/gcd.cpp | |
// I have modified the output to make it explicit and clear, modified the code in some functions | |
// to make them easier to follow and standardized variable names, and added the Ruby implementation. | |
// I also ordered the ouput to show fastest to slowest. | |
// The results: gcdwikipedia7fast32 is fastest by far; the implementation shown in widipedia is slowest. |
This file contains 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 bash | |
# castanet.sh: Script to connect a chromecast to a WiFi network. | |
# | |
# Allows you to put your Chromecast on WiFi and do Chromecast initial setup | |
# without using the Google Home app at all, just using a normal Linux computer. | |
# | |
# You do need your Chromecast to be on Ethernet, or (untested) to join its setup WiFi | |
# network with your PC, and you also need to find out its IP yourself with e.g. | |
# Wireshark. |
This file contains 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
import sys | |
import logging | |
import traceback | |
try: | |
import jsbeautifier | |
import requests | |
import requests_file | |
except Exception as e: | |
sys.exit(print("{0}.. please download this module/s".format(e))) |