Skip to content

Instantly share code, notes, and snippets.

@VFedyk
VFedyk / ytSubscriptionsSorted.js
Created September 12, 2022 06:10
Snippet for Chrome which sorts subscribed channels' videos on YouTube's Subscriptions page.
const parseViewsCount = (viewsCountLine) => {
const viewsNumberText = viewsCountLine.split(' ')[0]
if (viewsNumberText.includes('K')) {
return Number(viewsNumberText.split('K')[0]) * 1000
}
if (viewsNumberText.includes('M')) {
return Number(viewsNumberText.split('M')[0]) * 1000000
}
@VFedyk
VFedyk / swap-g-and-apostrophe.json
Created August 19, 2022 07:03
[Karabiner] Letters replacements for Ukrainian layout
{
"title": "Letters replacements for Ukrainian layout",
"rules": [
{
"description": "Change grave accent (`) to \\ in Ukrainian layout",
"manipulators": [
{
"conditions": [
{
"type": "input_source_if",
@VFedyk
VFedyk / uk-UA_letters.csv
Last active February 5, 2022 22:43
Осереднені частоти та дисперсії використання букв української мови
Літера Технічні тексти, частота Технічні тексти, дисперсія Вірші, частота Вірші, дисперсія Гуманітарні тексти, частота Гуманітарні тексти, дисперсія
а 0.0709 2.350E-05 0.0871 1.564E-04 0.0840 2.870E-05
б 0.0136 1.092E-05 0.0211 6.685E-08 0.0183 4.918E-06
в 0.0533 2.066E-05 0.0468 1.573E-05 0.0604 9.286E-05
г 0.0142 7.898E-06 0.0150 1.450E-05 0.0173 2.897E-06
д 0.0350 3.305E-05 0.0332 9.669E-07 0.0332 3.025E-06
е 0.0458 7.780E-05 0.0544 3.143E-07 0.0483 3.821E-05
ж 0.0066 2.227E-06 0.0108 1.457E-06 0.0106 3.962E-06
з 0.0238 2.096E-05 0.0220 3.176E-06 0.0239 7.000E-06
и 0.0613 3.346E-05 0.0633 3.170E-05 0.0632 9.140E-07
@VFedyk
VFedyk / keybase.md
Created June 24, 2019 11:27
keybase.md

Keybase proof

I hereby claim:

  • I am vfedyk on github.
  • I am vfedyk (https://keybase.io/vfedyk) on keybase.
  • I have a public key ASDgBtnijOxJtOaDYCsMhN_elmoKOKh5Ul9viSVEt77NhQo

To claim this, I am signing this object:

@VFedyk
VFedyk / make_timelapse.sh
Created June 30, 2016 07:44
make_timelapse.sh
#!/bin/bash
echo "Renaming files..."
mkdir renamed
counter=1
ls -1tr *.JPG | while read filename; do cp $filename renamed/$(printf %05d $counter)_$filename; ((counter++)); done
echo "Resizing ${counter} files..."
mkdir resized
mogrify -path resized -resize 1920x1080! -verbose renamed/*.JPG
@VFedyk
VFedyk / print_line.py
Created June 13, 2016 13:13
Draw the line with Python and PIL
from PIL import Image
im = Image.new('RGB', (800, 800), (0, 0, 0))
def line(ap, bp, color):
# (10 - 50) / ( 100 - 20) = -40 / 80 = -0.5
# (50 - 10) / (80 - 100) = 40 / -20 = -2
# (110 - 10) / (20 - 20)
angle_mul = float(bp[1] - ap[1]) / float(bp[0] - ap[0]) if bp[0] is not ap[0] else 0
@VFedyk
VFedyk / run_once.js
Created May 30, 2016 15:16
Function which executes only once
function executeOnce(func) {
var executed = false;
return function() {
// console.log('callback arguments', arguments);
// console.log('executed', executed);
if (!executed) {
executed = !executed;
return func.apply(null, arguments);
}
@VFedyk
VFedyk / hornetseye_photo.rb
Created March 19, 2015 06:35
Take webcam photo with Hornetseye
require 'hornetseye_v4l2'
require 'hornetseye_xorg'
require 'hornetseye_rmagick'
include Hornetseye
input = V4L2Input.new '/dev/video0'
img = input.read
filename = Time.now.strftime '%Y-%m-%d %H:%M:%S'
img.to_ubytergb.save_ubytergb "#{filename}.png"
@VFedyk
VFedyk / vhost.sh
Last active December 31, 2015 05:59 — forked from gistwebdev/vhost
#!/bin/bash
#
# Display usage info
vhost-usage() {
cat <<"USAGE"
Usage: vhost [OPTIONS] <name>
-h|--help this screen
-pub to create the webhost root in ~/www/name/public/
-url to specify a local address, default is http://name.local