Skip to content

Instantly share code, notes, and snippets.

View Rishi-Bidani's full-sized avatar

Rishi-Bidani Rishi-Bidani

  • India
View GitHub Profile
@mp035
mp035 / tk_scroll_demo.py
Last active June 19, 2024 08:19
A simple scrollable frame class for tkinter, including example usage.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
import tkinter as tk
import platform
# ************************
# Scrollable Frame Class
# ************************
@thom-s
thom-s / status_code.ps1
Last active July 26, 2022 12:22
Return Web Request Status Code as Integer (PowerShell Core 6)
$uri = "https://httpstat.us/404" # Replace '404' by any status code you want to test
try {
$r = Invoke-WebRequest -URI $uri -SkipCertificateCheck -MaximumRedirection 0
$a = [int]$r.StatusCode
}
catch {
$a = [int]$_.Exception.Response.StatusCode
}
write-output $a
@algomaster99
algomaster99 / doomsday_fuel.py
Created April 24, 2020 11:34
Solution to Doomsday Fuel foobar challenge
from fractions import Fraction
# Replace trials by probabilties of occurrences
def replace_probability(m):
for row in range(len(m)):
total = 0
for item in range(len(m[row])):
total += m[row][item]
if total != 0:
for item in range(len(m[row])):