Skip to content

Instantly share code, notes, and snippets.

View grafov's full-sized avatar
🫖
HTTP 418

Alexander I.Grafov grafov

🫖
HTTP 418
View GitHub Profile
@grafov
grafov / pdf2slides.go
Last active October 12, 2019 22:25
Very specific utility for my workflow with Kyocera MFU, it reorders the pages of a two-sided document scanned from two sides in two batches. MFU creates PDF with pages for example 1,2,3,6,5,4 and the utility reorders them to 1,2,3,4,5,6. The example of manipulating PDF in native Go without external utilities.
package main
import (
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"strings"
@grafov
grafov / pdf2reverse.go
Created November 5, 2019 18:57
Split PDF and merge pages back in a reverse order.
package main
import (
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
"strings"
@grafov
grafov / xgamemode.sh
Created January 25, 2020 17:31
my gaming settings for void linux
#!/bin/bash
sudo cpupower frequency-set -g performance >/dev/null
xrandr --output HDMI-0 --mode 1920x1080 --rate 60 --primary --output DVI-I-1 --off
feh -d --recursive --randomize --bg-scale /usr/share/backgrounds /usr/share/wallpapers 2>/dev/null
killall compton
nvidia-settings -l
@grafov
grafov / part-of-sway-config
Created April 3, 2021 14:08
Configuration for the remapping Kensington Expert Mouse buttons for Sway WM
# Copypaste it to your ~/.config/sway/config
set $TBALL 1149:4128:Kensington______Kensington_Expert_Mouse
# Turns on scrolling with the ball when right bottom button pressed.
input $TBALL {
scroll_method on_button_down
scroll_button 273
}
@grafov
grafov / haredoc.el
Last active June 22, 2024 18:03
Shows haredoc for the current word under cursor in the GNU/Emacs bufer.
(require 'ansi-color)
;; Shows haredoc for the selected or word.
(defun haredoc ()
"Run the haredoc with the current word under the cursor and display
the results in a new buffer."
(interactive)
(let* ((current-word
(if (use-region-p) ;; Use region or the current word
(setq current-word (buffer-substring-no-properties (region-beginning) (region-end)))
@grafov
grafov / keymap.c
Last active September 9, 2024 10:25
How to implement "SNAP TAP" like feature on QMK keyboard
// Not for copypaste! It is only part of keymap.c!
// You should adapt the code above for your keyboard especially for your layers.
// WARNING! You could be banned in Valve games because the feautre treated by Valve as a cheat.
//
// It uses two user hooks: layer_state_set_user() and process_record_user() as defined by QMK.
// Example enum with layers.
enum layers {
DEFAULT_LAYER,
GAME_LAYER,