Skip to content

Instantly share code, notes, and snippets.

View motatoes's full-sized avatar
🎯
Focusing

Mohamed Habib motatoes

🎯
Focusing
View GitHub Profile
TEST
=====
```
@pytest.mark.darwin
def test_osx_app_console_option(tmpdir, pyi_builder_spec, monkeypatch):
# -*- mode: python ; coding: utf-8 -*-
app_path = os.path.join(tmpdir, 'dist',
'osx console option.app')
is_console_path = os.path.join(tmpdir, 'dist', 'itsaconsole.txt')
✗ pytest tests/functional -k test_osx_app_console_option
Error processing line 1 of /Users/mohamedsayed/.pyenvs/py3/lib/python3.9/site-packages/matplotlib-3.3.2-py3.9-nspkg.pth:
Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site.py", line 169, in addpackage
exec(line)
File "<string>", line 1, in <module>
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/util.py", line 2, in <module>
from collections import deque
class Solution:
def isValid(self, s: str) -> bool:
l = deque()
for i in range(len(s)):
if s[i] in "[({":
l.append(s[i])
elif s[i] in "})]":
if len(l) == 0:
import math
import sys
# a = 999
# b = 1234
# 901
# 123
# a = 881
import sys
def valid(n):
return len(set(str(n))) == len(str(n))
a,b = list(map(int,input().split()))
for i in range(a,b+1):
if valid(i):
print(i)
# this function takes a number and returns true if the digits of `n` are distinct otherwise returns false
def valid(n):
return len(set(str(n))) == len(str(n))
# this variable will hold the maximum range found so far
mrange = 0
# this variable keeps track of the start for our range
start = 0
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@motatoes
motatoes / hist.py
Last active August 29, 2018 22:29
matplotlib hist adjustment
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
np.random.seed(209313920)
x = np.random.randint(1, 4, 500)
# we can see that the histgram x-ticks seems insensible when the
# range of values is small
@motatoes
motatoes / unlimited.py
Last active March 12, 2018 19:24
script to select n number of ROIs in ropily.py
# import pylab as pl
from matplotlib import pyplot as pl
from matplotlib.widgets import Button
import numpy as np
from roipoly import roipoly
img = np.ones((100, 100)) * range(0, 100)
ROIs = []
fig = pl.Figure()
done = False
@motatoes
motatoes / gist:81f9dee49923376b7ad032cd3957b797
Last active February 26, 2018 09:31
Tampermonkey Userscript to hide codeforces rankings
// ==UserScript==
// @name CF no ranks
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://codeforces.com/
// @grant none
// ==/UserScript==