Skip to content

Instantly share code, notes, and snippets.

View Flid's full-sized avatar

Anton Kirilenko Flid

  • Facebook
  • London, UK
View GitHub Profile
for i in range(2, n/2):
if not n % 1:
flag = 1;
break
if n == 1:
print("1 is neither a prime nor a composite number.")
else:
if flag == 0:
print(f"{n} is a prime number.")
# Start a Screen session with a bunch of tabs
SESSION_NAME="foobaz"
screen -dmS $SESSION_NAME
current_screen_i=0
function new_screen {
screen -rd -S $SESSION_NAME -p0 -X screen
current_screen_i=$((current_screen_i + 1))
# Tab bar
hardstatus alwayslastline
hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b g} [%n*%t]%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]'
# huge scrollback buffer
defscrollback 5000
# To clear the screen after closing some programs
altscreen on
@Flid
Flid / test.py
Created August 22, 2018 10:04
block vs single-byte write
from time import perf_counter
from contextlib import contextmanager
N = 1000000
BLOCK_SIZE = 10000
@contextmanager
def measure_time(name):
start_time = perf_counter()
yield