Skip to content

Instantly share code, notes, and snippets.

View gelosi's full-sized avatar

Oleg Shanyuk gelosi

  • Berlin
View GitHub Profile
#!/usr/bin/python
import argparse
import os
parser = argparse.ArgumentParser(description='Process input icon and output a set of icons with given sizes')
parser.add_argument('file', metavar = 'F', type=str, default="icon.png", help='file to look for')
parser.add_argument('--sizes', type=float, nargs='+', default=[20, 29, 40, 60, 76, 83.5], help='sizes for processing')
#pass me as parameter to parse_args if any :)
@gelosi
gelosi / geekbench_scan.sh
Created April 6, 2020 09:53
Scan quickly geekbench (any webpage, actually) for info which interest you
% curl -sS https://browser.geekbench.com/mac-benchmarks/ | grep -i "MacBook Air.*2020"
# DISCLAMER: straightforward, might break any time xD
# this will strip html and will sort strings, so, you will see same model data next to each other
search_year=`date +%Y`
search_model="" #any model
search_model_message="any model"
if [ -n "$1" ]; then
echo "YEAR supplied: $1"
@gelosi
gelosi / zsh_config_plus_local_gems.zshrc
Last active October 18, 2020 08:45
add user-installed gems to PATH using zsh's config file (~/.zshrc)
# setup local gems path [yeah, fucking 2020 and it's still a problem]
if which ruby >/dev/null && which gem >/dev/null; then
PATH="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin:$PATH"
fi
@gelosi
gelosi / grepper
Created November 11, 2020 16:51
Find text in files
grep -lr "text to search" .
# this is PATH ⤴️
grep -ilr "text to search ignoring case" .
mdfind text to search
# the system tool, quite powerful - searching for file names & contents (aka Spotlight)
@gelosi
gelosi / tryme.sh
Created February 18, 2021 17:22
sample of auto-updating terminal status command
# this can be useful to monitor directories which are updated at some interval
# or you just curious :)
while; do; clear; tree mygitrepo/.git; du -sh mygitrepo; sleep 1; done;
@gelosi
gelosi / logline.py
Created July 25, 2022 18:56
primitive analysing mac system log looking for gaps (e.g. sleep/off times) MacOS Sierra [ newer would requre changes in grep ]
import pathlib
import argparse
import re
import datetime
parser = argparse.ArgumentParser(description="Looking for gaps in syslogs")
parser.add_argument("log", type=pathlib.Path, help="Path to syslog dump")
parser.add_argument("-m", "--min-interval", type=int, default=7200, help="Minimal Interval in seconds to print out (default is 2h / 7200 seconds)")
parser.add_argument("-r", "--regexp", type=str, help="also look for strings expressed by Regular Expression (python's re syntax)")
parser.add_argument("--debug", type=int, help="Stop After X Lines parsed (debug option)")