Skip to content

Instantly share code, notes, and snippets.

View grafov's full-sized avatar
🛸
I want to believe

Alexander I.Grafov grafov

🛸
I want to believe
View GitHub Profile
@grafov
grafov / synaptics.diff
Created June 24, 2014 18:06
Patch for synaptics.c for report finger width (still actual for 3.14.3). Taken from http://pastebin.com/rjGyM5pC
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -702,6 +702,8 @@
input_report_abs(dev, ABS_MT_POSITION_X, hw->x);
input_report_abs(dev, ABS_MT_POSITION_Y, synaptics_invert_y(hw->y));
input_report_abs(dev, ABS_MT_PRESSURE, hw->z);
+ if (hw->w >= 4)
+ input_report_abs(dev, ABS_TOOL_WIDTH, hw->w);
}
<?php
// EDIT MY PATH
$file = strtolower(file_get_contents('/Users/YOURUSER/Sites/TEST_TEST.txt'));
function get_points($layout = 'Norman') {
switch ($layout) {
case 'QWERTY':
$points[1] = array('s', 'd', 'f', 'j', 'k', 'l');
@grafov
grafov / gist:3730213
Created September 15, 2012 22:50
Send current buffer to server:port
(defun tcp-send (server port &optional timeout)
"Отправить текст текущего буфера на server:port"
(if (not timeout) (setq timeout 60))
(let* ((res "*TCP/Result*")
(cur-buf (buffer-name))
(proc (open-network-stream "TcpRequest"
(progn (switch-to-buffer (get-buffer-create res))
(erase-buffer)
(switch-to-buffer cur-buf) res)
@grafov
grafov / keybase.md
Created February 9, 2017 12:51
Prove for keybase.io

Keybase proof

I hereby claim:

  • I am grafov on github.
  • I am grafov (https://keybase.io/grafov) on keybase.
  • I have a public key ASAUg76BXpiydF8Zf2e2qaTYNRo1cPkHNvrOB5cK7-Z0DQo

To claim this, I am signing this object:

@grafov
grafov / wwwsearch.sh
Created March 22, 2018 23:15
Web search in Surf with history (with using Rofi)
#!/bin/dash
AGENT="Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20090913 Firefox/3.5.3"
#OPTS='-z 1.5 -u "$AGENT"'
OPTS="-z 1.8"
HISTORY=.rofi-wwwsearch-history
if [ "$1" = "" ]
then
@grafov
grafov / gist:5712165
Created June 5, 2013 07:22
golang sample of json/rpc over websocket
package main
import (
"code.google.com/p/go.net/websocket"
//"github.com/garyburd/go-websocket/websocket"
//"github.com/zhangpeihao/gowebsocket"
"net/http"
"net/rpc"
"net/rpc/jsonrpc"
)
@grafov
grafov / fcd.fish
Created September 13, 2019 12:01
Small fish-shell function for using fzf to navigating fast to directories by any part of path or filename that belong to the target directory.
# It uses fzf: https://github.com/junegunn/fzf
function fcd
cd ~
if [ (count $argv) -ge 1 ]
cd (dirname (fzf -q "$argv"))
return
end
cd (dirname (fzf))
end
@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