Skip to content

Instantly share code, notes, and snippets.

View antonpetrovmain's full-sized avatar

Anton Petrov antonpetrovmain

View GitHub Profile
@antonpetrovmain
antonpetrovmain / archive-messages.js
Created October 21, 2019 10:48
How to archive all messages from inbox?
(function run() {
let all = document.querySelectorAll('div[aria-label="Conversation actions"]');
if (all.length == 0) return;
let a = all[0];
a.click();
setTimeout(() => {
document.querySelectorAll('a[role=menuitem]').forEach(act => {
if (act.innerText.match(/Archive/)) act.click();
});
run();
@antonpetrovmain
antonpetrovmain / flip-board-automatically-chessable.js
Created October 18, 2022 10:42
Flip the chess board in Chessable exercises more easily.
// ==UserScript==
// @name Flip Chessable Board
// @namespace https://blz777.github.io/
// @version 0.1
// @description Flip the chess board in Chessable exercises more easily.
// @author You
// @match https://*.chessable.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=chessable.com
// @grant none
// @require http://code.jquery.com/jquery-3.4.1.min.js
@antonpetrovmain
antonpetrovmain / org.eclipse.jdt.core.prefs
Created May 10, 2023 13:14 — forked from fbricon/org.eclipse.jdt.core.prefs
formatter settings under .settings/org.eclipse.jdt.core.prefs
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
@antonpetrovmain
antonpetrovmain / README.en.md
Created July 29, 2023 13:33 — forked from akihikodaki/README.en.md
Linux Desktop on Apple Silicon in Practice

Linux Desktop on Apple Silicon in Practice

I bought M1 MacBook Air. It is the fastest computer I have, and I have been a GNOME/GNU/Linux user for long time. It is obvious conclusion that I need practical Linux desktop environment on Apple Silicon.

Fortunately, Linux already works on Apple Silicon/M1. But how practical is it?

  • Two native ports exist.
@antonpetrovmain
antonpetrovmain / Arch on Mac M1.txt
Created July 29, 2023 20:58 — forked from ReturnRei/Arch on Mac M1.txt
Install Arch / EndeavourOS Mac M1 Parallels
This gist is provided as an addition to my youtube video
https://www.youtube.com/watch?v=dKvetujHjYQ&t=737s
## Useful links
https://wiki.archlinux.org/title/Install_Arch_Linux_from_existing_Linux#Using_a_chroot_environment
https://archlinuxarm.org/platforms/armv8/generic
https://www.reddit.com/r/archlinux/comments/6kwt61/systemd_doesnt_create_machineid_during/
https://arm.endeavouros.com/endeavouros-arm-install/
## Get into chroot
@antonpetrovmain
antonpetrovmain / latency.txt
Created November 20, 2023 16:21 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@antonpetrovmain
antonpetrovmain / QWERTY no option.keylayout
Created December 3, 2023 13:42 — forked from greneholt/QWERTY no option.keylayout
Mac QWERTY keyboard layout without bindings for the option key. This disables the annoying default behavior of key combinations like option+i that enters diacritic mode and prevents using such shortcuts in VS Code.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard SYSTEM "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<keyboard group="0" id="5000" name="QWERTY no option" maxout="1">
<layouts>
<layout first="0" last="0" modifiers="48" mapSet="312" />
</layouts>
<modifierMap id="48" defaultIndex="0">
<keyMapSelect mapIndex="0">
<modifier keys="" />
</keyMapSelect>
@antonpetrovmain
antonpetrovmain / TermuxArchSetup2020.md
Created April 12, 2024 06:06 — forked from RebelLion420/TermuxArchSetup2024.md
How to set up Arch Linux in Termux on Android

So, to get started you need to get the base OS installed using the instructions from the official docs .

$ pkg update

$ pkg install bsdtar wget proot tergent tmux openssh

Tmux is a multiplexer that lets you run multiple persistent windows and sessions on a single terminal. I had trouble getting it working in the Arch proot, so a workaround is configuring tmux from your host Termux and then creating a tmux session and starting the chroot from there. For more information on using tmux read this article, and to learn how to customize the appearance and behaviors more try this one as well as looking at the tmux-plugins Github organization for community-built add-ons.

$ termux-setup-storage

@antonpetrovmain
antonpetrovmain / path.md
Created June 22, 2024 03:17 — forked from romainl/path.md
Off the beaten path

Off the beaten path

What is &path used for?

Vim uses :help 'path' to define the root directories from where to search non-recursively for files.

It is used for:

  • gf, gF, <C-w>f, <C-w>F, <C-w>gf, <C-w>gF,
  • :find, :sfind, :tabfind,