Skip to content

Instantly share code, notes, and snippets.

Avatar

Borys Makogonyuk Vasylev lances101

  • Eindhoven, Netherlands
View GitHub Profile
@lances101
lances101 / querySelector_shadowDOM.js
Created Sep 3, 2018
querySelector and querySelectorAll that looks in the ShadowDOM
View querySelector_shadowDOM.js
// quick and ugly implementation to be able to query both dom and shadowdom
function find(elem, selector) {
for(var i = 0; i < elem.children.length; i++){
let child = elem.children[i];
if(child.matches(selector))
return child;
found = find(child, selector);
if(found)
return found;
@lances101
lances101 / callbill.py
Created Jul 19, 2018
Python 3.6 CallBill machine look up
View callbill.py
#
# 1. logs in to CallBill via its API.
# 2. pulls location from config or CallBill profile if not defined
# 3. searches for matching machines based on filters in config
# (default: washing machines that are available)
# 4. once the check cycle is finished, calls config.found_func
# (default found_func calls OSX "say" executable)
# 5. waits X seconds before next attemp
# (default 60 seconds)
@lances101
lances101 / callbill.js
Created Jul 19, 2018
http://call-bill.com washing machine availability notifier
View callbill.js
/**
* visits call-bill.com, logs in and
* searches for available washing machines
* execs whatever is in the exec command when machine is found
* by default uses OSX "say" command.
* =====
* requires puppeteer: npm i puppeteer
* =====
*/
@lances101
lances101 / wox_uninstaller.bat
Last active Feb 9, 2018
Wox uninstaller bat tool
View wox_uninstaller.bat
@echo off
echo === Wox uninstallation utility ===
echo Now running Squirrel uninstaller
%LOCALAPPDATA%\Wox\Update.exe --uninstall .
echo Deleting Wox application files
rmdir %LOCALAPPDATA%\Wox /S /Q
echo Deleting Wox configuration files
rmdir %APPDATA%\Wox /S /Q
View hotline_uah_to_eur.js
// ==UserScript==
// @name HotlineUA UAH to EUR
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Boromak
// @match http://hotline.ua/*
// @grant none
// ==/UserScript==
@lances101
lances101 / Metro Server - No subtitles.xaml
Created Jan 10, 2018
Metro server theme with no subtitles
View Metro Server - No subtitles.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Base.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="QueryBoxStyle" BasedOn="{StaticResource BaseQueryBoxStyle}" TargetType="{x:Type TextBox}">
<Setter Property="Background" Value="#ffffff"/>
<Setter Property="Foreground" Value="#000000" />
</Style>
<Style x:Key="WindowBorderStyle" BasedOn="{StaticResource BaseWindowBorderStyle}" TargetType="{x:Type Border}">
<Setter Property="Background" Value="#001e4e"></Setter>
View main.py
# -*- coding: utf-8 -*-
from wox import Wox, WoxAPI
import webbrowser
class Main(Wox):
def query(self, query):
results = []
if query[0] == "!":
View locales_parser.py
###
# Downloads and parses https://lh.2xlibre.net/locales/ into a
# JSON file split into the following fields:
# - code: locale code, i.e. 'en_GB'
# - suffix: locale code suffix, i.e. 'latin' from 'be_BY'
# - name: locale name, i.e. 'English' from 'en_GB'
# - country: locale country 'title'lized, i.e. 'United Kingdom' from 'en_GB'
# Settings as on where to save the html file and locale file can be found below
###
View gotadmin.bat
@echo off
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
@lances101
lances101 / LocationCalculator.java
Created Jun 3, 2016
A location calculator for Exploration 2016
View LocationCalculator.java
public class LocationUtility {
public static boolean areColliding(Location lvalue, Location rvalue) {
return lvalue.getX() == rvalue.getX() && lvalue.getY() == rvalue.getY();
}
private static void applyDirection(Location loc, int modX, int modY, int sizeX, int sizeY){
Location newLoc = new Location();
if(loc.getX() + modX > sizeX)
newLoc.setX(1);
else if(loc.getX() + modX < 1)
newLoc.setX(sizeX);