Skip to content

Instantly share code, notes, and snippets.

View f-person's full-sized avatar
🛸
🤹

arshak kharnogh f-person

🛸
🤹
View GitHub Profile
@f-person
f-person / data_with_error.dart
Created November 9, 2020 11:09
Go-inspired error handling in Dart
import 'package:dio/dio.dart';
typedef _DataOrErrorFunction<T> = Future<T> Function();
class DataWithError<T> {
final String error;
final T data;
const DataWithError({this.error, this.data});
@f-person
f-person / duration_calculator.py
Last active May 27, 2020 09:22
This script takes list of durations and outputs their sum: duration should be in format hours:minutes:seconds (example: python3 duration_calculator.py 2:02:21 3:1:34)
import datetime
import sys
duration_sum_seconds = 0
args = sys.argv[1:]
for duration_str in args:
duration_str_parts = duration_str.split(':')
for i in range(len(duration_str_parts)):
if duration_str_parts[i][0] == '0' and len(duration_str_parts[i]) > 1:
@f-person
f-person / break_notifier.py
Created February 15, 2020 14:36
A little script that will remind you about taking a break
#!/usr/bin/python3
import easygui, time
title = "Take care about your eyes <3"
body = "It's time to take a break\nClick 'OK' when you are back"
while True:
print("Started counting at", time.ctime())
time.sleep(60 * 21) # 21 minutes
easygui.msgbox(body, title)
@f-person
f-person / .xscreensaver
Last active June 5, 2019 19:46
XScreenSaver Preferences
# XScreenSaver Preferences File
# Written by xscreensaver-demo 5.42 for fperson on Wed Jun 5 23:32:06 2019.
# https://www.jwz.org/xscreensaver/
timeout: 0:01:00
cycle: 0:01:00
lock: True
lockTimeout: 0:01:00
passwdTimeout: 0:00:30
visualID: default