Skip to content

Instantly share code, notes, and snippets.

Avatar

Vít Šesták v6ak

View GitHub Profile
@v6ak
v6ak / gridify-svg.py
Last active Mar 12, 2019
Creates grid from SVG. Note that full image can be recovered from any piece, because any piece contain the full image just with modified boundaries.
View gridify-svg.py
#!/usr/bin/env python3
import argparse
import xml.etree.ElementTree
import re
import os
from collections import namedtuple
from decimal import Decimal
from fractions import Fraction
@v6ak
v6ak / ms-force-en.user.js
Last active Nov 14, 2018
Forces desired language on MS website. You need GreaseMonkey / TamperMonkey. Then click the “RAW” button to install it.
View ms-force-en.user.js
// ==UserScript==
// @name Microsoft: force desired language
// @version 1
// @grant none
// @include https://docs.microsoft.com/*/*
// ==/UserScript==
const DESIRED_LANGUAGE='en-us';
var locParts = /^(https:\/\/docs\.microsoft.com)\/([a-z]+-[a-z]+)\/(.*)$/.exec(location.href);
if(locParts){
@v6ak
v6ak / webex-teams-notifications-icon.user.js
Last active Nov 5, 2018
Webex Teams notification icon adjustment. Needs GreaseMonkey (or equivalent). After installing GM, just click the “Raw” button.
View webex-teams-notifications-icon.user.js
// ==UserScript==
// @name WebEx Teams notification icon
// @version 1
// @namespace v6ak
// @description This script will show a notification icon on WebEx Teams when there is a new message. It distinguishes between direct messages (or mentions or other higher-priority messages) and group messages.
// @grant none
// @include https://teams.webex.com/*
// ==/UserScript==
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

View build-native.sh
#!/bin/bash
# safety settings
set -u
set -e
set -o pipefail
VERSION="$(sed -n 's#^.*bin/robozonky-app-\([0-9a-z.-]\+\).jar.*$#\1# p' Dist/robozonky.sh | head -n1)"
echo Trying to build native image for RoboZonky version $VERSION
@v6ak
v6ak / gist:b6e1c18b85ad2dc19c03cac1669b65d0
Created May 19, 2018
Removes titlebar from maximized windows
View gist:b6e1c18b85ad2dc19c03cac1669b65d0
#!/bin/bash
# Inspired by https://gist.github.com/tuxor1337/74e76d3d153c67593454
# Replaced polling by events
xdotool getwindowfocus behave %@ blur get_num_desktops | while read _; do
for id in $(xdotool search --class '.*'); do
xprop -id $id -f _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED 32c -set _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED 0x1
done
done
View pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>ad-hoc-project</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
View gist:b67ce6f501c74f7e617b4a12b38820cb
$ for i in /var/log/Xorg.0.log /var/log/Xorg.0.log.old; do cat $i | sed 's/\[[ 0-9.]\+]/[TIME]/' | sort -u > /tmp/$(basename $i); done; diff /tmp/Xorg.0.log.old /tmp/Xorg.0.log
36c36
< [TIME] Current Operating System: Linux dom0 4.9.56-21.pvops.qubes.x86_64 #1 SMP Tue Oct 17 23:58:50 UTC 2017 x86_64
---
> [TIME] Current Operating System: Linux dom0 4.14.18-1.pvops.qubes.x86_64 #1 SMP Thu Feb 8 19:37:36 UTC 2018 x86_64
55c55
< [TIME] (**) evdev: Dell WMI hotkeys: Device: "/dev/input/event9"
---
> [TIME] (**) evdev: Dell WMI hotkeys: Device: "/dev/input/event10"
58c58
@v6ak
v6ak / Main.java
Created Mar 25, 2018
Rough edge of Java 10 type inference
View Main.java
package test;
import java.util.List;
import java.util.ArrayList;
import java.io.Serializable;
public class Main {
private static void trick(List list){
// WARNING: black magic with non-generic code on a generic List…
@v6ak
v6ak / dnsserver.py
Created Mar 14, 2018
Simple DNS server intended for responding ACME challenges. Assumes ownership of /etc/authbind/byport/53.
View dnsserver.py
#/usr/bin/env authbind python3
from dnslib.label import DNSLabel
from dnslib.server import DNSServer, DNSLogger, DNSRecord, RR
from dnslib.dns import TXT
import re
import sys
import os
from os import listdir