Skip to content

Instantly share code, notes, and snippets.

View basilevs's full-sized avatar

Vasili Gulevich basilevs

View GitHub Profile
@basilevs
basilevs / vboxservice
Created March 11, 2012 09:18
Virtal box machine as linux service
#!/bin/sh
#Manages VBox machines
if [ $# -ne 3 ]; then
echo sudo -n -H -u USER $0 MACHINE SNAPSHOT {start|stop}
# -n - noninteractive
# -H - provide HOME variable (required by VBox communication link)
# -u - run as user (owns VM)
fi
@basilevs
basilevs / cmdInFolder.cmd
Created June 16, 2012 16:49
CMD script to run cmd in a folder. To put in SendTo.
%~d1
cd %~f1
cmd /K
@basilevs
basilevs / gist:3848511
Created October 7, 2012 14:18
HTA network drives mounting
<html>
<head>
<title>Сетевые диски</title>
<meta http-equiv="x-ua-compatible" content="ie=9">
<hta:application
id="gymlogin"
applicationname="gymlogin"
version="1"
scroll="no"
singleinstance="yes"
@basilevs
basilevs / redirectTest.py
Last active October 13, 2015 21:07
Redirect all current process output to a file
#!/usr/bin/python
# coding: utf-8
from sys import stderr, stdout
from os import dup, dup2, close
from subprocess import Popen, PIPE
from contextlib import contextmanager
from time import sleep
from traceback import print_exc
@contextmanager
#include <limits>
#include <assert.h>
template<class T>
long compensateOverflow(long near, T value)
{
using namespace std;
static const long delta = long(numeric_limits<T>::max()) - numeric_limits<T>::min() + 1;
assert(delta%2 == 0);
@basilevs
basilevs / gist:8432073
Last active January 3, 2016 07:49
Vozone Nsis Maven plugin trouble
package org.vozone.nsis;
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
Suppose we want to parse a text stream where each line is one or two integers:
1 2
3
4 6
Lines come in random order.
Thread [main] (Suspended)
owns: RunnableLock (id=223)
OS.SetWindowPos(int, int, int, int, int, int, int) line: not available [native method] [local variables unavailable]
TableColumn(Widget).SetWindowPos(int, int, int, int, int, int, int) line: 1457
TableColumn.pack() line: 449
MultiAutLaunchTab$1.controlResized(ControlEvent) line: 66
TypedListener.handleEvent(Event) line: 234
EventTable.sendEvent(Event) line: 84
Table(Widget).sendEvent(Event) line: 1053
Table(Widget).sendEvent(int, Event, boolean) line: 1077
@basilevs
basilevs / Click to play
Created January 9, 2015 13:37
Skips ads
// ==UserScript==
// @name Click to play
// @namespace basilevs
// @description Skips legal warnings
// @include http://watch*series.*/open/cale/*
// @include http://daclips.in/*
// @version 1
// @grant GM_log
// ==/UserScript==