Skip to content

Instantly share code, notes, and snippets.

View andriihomiak's full-sized avatar
🇺🇦

Andrii Khomiak andriihomiak

🇺🇦
  • Ukraine
View GitHub Profile
@andriihomiak
andriihomiak / README.md
Last active August 11, 2023 09:25
Grid image generator (customizable color, cell size, page margins, grid size)

Synopsis

$ python3 generate_grid.py --help
usage: generate_grid.py [-h] --rows ROWS --cols COLS --cell-size CELL_SIZE [--grid-color GRID_COLOR] [--h-padding H_PADDING] [--v-padding V_PADDING] --output OUTPUT

Generate a grid image

options:
 -h, --help show this help message and exit
@andriihomiak
andriihomiak / download-wl.md
Created August 5, 2023 19:34
Download the videos from "watch later" playlist using yt-dlp, jq and firefox cookies

Download the watchlist

yt-dlp "https://www.youtube.com/playlist?list=WL" \
  --cookies-from-browser firefox \
  -j --flat-playlist \
  | jq -r '.url' > watch-later.txt

Can be put into a cron job!

Download the videos

httpClient = new HttpClient(new RetryOnUnauthorizedMessageHandler(new HttpClientHandler()));
/// <summary>
/// See https://stackoverflow.com/a/49304655
/// </summary>
public class RetryOnUnauthorizedMessageHandler : DelegatingHandler
{
public RetryOnUnauthorizedMessageHandler(HttpMessageHandler innerHandler) : base(innerHandler)
{
}

100 Days Of ML Code - Example Log

Use this as a base template. Create your own repository on GitHub and start logging your work daily!

Day 0: February 29, 2016 (Example 1)

(delete me or comment me out)

Today's Progress: Fixed CSS, worked on canvas functionality for the app.

Thoughts: I really struggled with CSS, but, overall, I feel like I am slowly getting better at it. Canvas is still new for me, but I managed to figure out some basic functionality.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
Функція яка виконує розбиття масиву
Аргумент kind відповідає за вибір опорного елемента:
m - обирається середнє значення з медіани, першого та останнього елементів;
значення за замовчуванням
s - перший елемент стає опорним
e - останній елемент стає опорним
Складність - O(e - s) (лінійна від розміру підмасиву що розбивається)
Повертає правильну позицію опорного елемента
"""
@andriihomiak
andriihomiak / 02_inversions.py
Last active May 29, 2018 17:32
Лаба №2
"""
Функція яка виконує злиття двох відсортованих масив та підраховує інверсії
повертає пару значень (відсортований_масив, кількість_інверсій_при_злитті)
Складнійсть - O(n) (лінійно залежить від n - довжини всідних масивів)
Використовує додаткову память розміром 2n
"""
def merge_inversion(l, r):
# індекси які будуть рухатися по масивах
i = j = 0
@andriihomiak
andriihomiak / fragment_replies.xml
Last active April 4, 2018 10:40
Need to set appbarlayout elevation to 1dp
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout ...
>
<android.support.design.widget.CoordinatorLayout
...
>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"