Skip to content

Instantly share code, notes, and snippets.

@mistificator
mistificator / getWorkTime.ps1
Last active February 20, 2018 14:41
Calculates the worktime since month beginning
#*=============================================================================
#* Script Name: getWorkTime
#* Based on True Percent Uptime, https://gallery.technet.microsoft.com/scriptcenter/True-Uptime-Calculator-5903cf22
#* Created: 20/02/2018
#* Authors: James Keeler, Mist Poryvaev
#*
#* Params: [int]$Holidays - number of holidays, default is 0.
#*
#*=============================================================================
#* Purpose: Calculates the worktime since month beginning.
// ==UserScript==
// @name Google Hacked Pic
// @namespace http://www.google.*/
// @include http://www.google.*/search?*tbm=isch*
// @include https://www.google.*/search?*tbm=isch*
// @include http://www.google.*/imgres?*imgurl=*
// @include https://www.google.*/imgres?*imgurl=*
// @version 0.2.1
// @description Click left mouse button on image. Use Download and Copy Link buttons. Kek.
// @author Mist Poryvaev
// ==UserScript==
// @name Yandex.Direct Killer
// @namespace https://gist.github.com/mistificator
// @run-at document-end
// @include http://lenta.ru/*
// @include https://lenta.ru/*
// @version 0.3
// @description Kills Yandex Direct on Lenta.ru.
// @author Mist Poryvaev
// @grant none
rem ### Download patched sources https://github.com/annulen/webkit/wiki
rem ### Initial instructions https://trac.webkit.org/wiki/BuildingQtOnWindows
rem ### Install OpenSSL, ActiveState Perl, Python 2.x, Ruby, CMake
rem ### -------- Install GnuWin32: Bison, GPerf, Grep, Flex and win_flex, LibIconv
rem ### -------- Replacing flex.exe with win_flex.exe may save your life :)
rem ### -------- Create folder PATH_TO_QTWEBKIT_SOURCES/WebKitLibraries/win
rem ### Select right toolchain: -G \"CMAKE_GENERATOR_NAME\", for example -G \"Visual Studio 15 2017 Win64\", see https://cmake.org/cmake/help/v3.11/generator/Visual%20Studio%2015%202017.html
rem ### Here is main build command, add it in Qt Creator as special project build step
rem ### perl.exe PATH_TO_QTWEBKIT_SOURCES\Tools\Scripts\build-webkit --qt --release --cmakeargs="-G \"CMAKE_GENERATOR_NAME\" -T host=x64 -Wno-dev -DCMAKE_PREFIX_PATH=PATH_TO_QT"
// ==UserScript==
// @name BanHammer
// @namespace https://gist.github.com/mistificator
// @version 0.1
// @description BanHammer bans ads and banners by hardcoded banlist. Ban, ban, ban!!!11
// @author Mist Poryvaev
// @match *://*/*
// @run-at document-end
// ==/UserScript==
@mistificator
mistificator / odbc_bridge.cpp
Last active June 6, 2018 09:07
Command-line tool that converts ODBC-database from DSN to DSN (primarily made for Paradox to SQLite conversion)
#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
#include <QtCore/QTextCodec>
#include <QtCore/QTime>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlError>
#include <QtSql/QSqlDriver>
#include <QtSql/QSqlTableModel>
#include <QtSql/QSqlRecord>
@echo off
:-------------------------------------
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"
)
REM --> If error flag set, we do not have admin.
@mistificator
mistificator / agg.sql
Created October 4, 2018 12:54 — forked from ryandotsmith/agg.sql
Postgres array concatenation aggregate function.
CREATE AGGREGATE array_accum (anyarray)
(
sfunc = array_cat,
stype = anyarray,
initcond = '{}'
);
@mistificator
mistificator / relation_array_accum.sql
Last active October 4, 2018 13:38
Accum in array with relation values got from SELECT
SELECT DISTINCT
schedule_groups.id,
schedule_groups.description,
schedule_groups.groups_id,
array_agg(groups.id),
array_to_string(
ARRAY(
SELECT DISTINCT * FROM unnest(
array_accum(
ARRAY(
Dir | Rename-Item -NewName {$_.name -replace "old_filename_part", "new_filename_part"}