Skip to content

Instantly share code, notes, and snippets.

View mrchnk's full-sized avatar
☮️
NO WAR, PLEASE!

Nikolay Sukharev mrchnk

☮️
NO WAR, PLEASE!
View GitHub Profile
@mrchnk
mrchnk / binary-heap.js
Last active April 13, 2021 07:14
Binary heap in JavaScript
module.exports = { push, pop, heap }
function push(heap, el, cmp = _cmp) {
let i = heap.length;
heap.push(el);
while (i > 0) {
const parent = Math.ceil(i / 2) - 1;
if (cmp(heap[i], heap[parent]) > 0) {
break;
}
@mrchnk
mrchnk / server.py
Created February 10, 2019 18:41
debug wsgi application using python run configuration
from livereload import Server
from web_app import application
if __name__ == "__main__":
server = Server(application)
server.watch(".")
server.serve(8080)
@mrchnk
mrchnk / patch.diff
Last active January 14, 2019 21:22
Workaround for RSL-linked items in swf
diff --git a/scripts/format/swf/SWFRoot.hx b/scripts/format/swf/SWFRoot.hx
index 626f59d..33ecf86 100644
--- a/scripts/format/swf/SWFRoot.hx
+++ b/scripts/format/swf/SWFRoot.hx
@@ -13,6 +13,8 @@ import flash.utils.ByteArray;
import flash.utils.CompressionAlgorithm;
import flash.errors.Error;
import format.swf.tags.TagSymbolClass;
+import format.swf.tags.TagPlaceObject;
+import format.swf.tags.TagDefineSprite;
@mrchnk
mrchnk / slack-comment-workflow-multiple.js
Last active June 12, 2023 12:45
Example youtrack workflow. It notifies some user about new mentions in comments.
var entities = require('@jetbrains/youtrack-scripting-api/entities');
var http = require('@jetbrains/youtrack-scripting-api/http');
var slackIdByUsername = {}
slackIdByUsername['@person1'] = '{person1_slack_id}';
slackIdByUsername['@person2'] = '{person2_slack_id}';
slackIdByUsername['@person3'] = '{person3_slack_id}';
var webhookUrl = 'https://{slack_webhook_url}';
@mrchnk
mrchnk / InspectorIssue.as
Last active April 4, 2018 09:31
"Missed superclass's constructor invocation" on intelliJ IDEA (issue IDEA-172044)
package {
public class InspectorIssue {}
}
class ClassA {
public function ClassA(argument) {}
}
class ClassB extends ClassA {
@mrchnk
mrchnk / gist:d07c443985db918286b0e1725d59656d
Created March 21, 2018 21:51 — forked from haf/gist:2843680
Get SSH working on Vagrant/Windows/Git

If you are using vagrant, you probably-statistically are using git. Make sure you have its binary folder on your path, because that path contains 'ssh.exe'.

Now, modify C:\vagrant\vagrant\embedded\lib\ruby\gems\1.9.1\gems\vagrant-1.0.3\lib\vagrant\ssh.rb to comment out the faulty Windows check and add a real SSH check:

# if Util::Platform.windows?
  # raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],
                                       # :port => ssh_info[:port],
                                       # :username => ssh_info[:username],
 # :key_path => ssh_info[:private_key_path]
@mrchnk
mrchnk / svn-to-git.md
Created March 19, 2018 10:20 — forked from barrysteyn/svn-to-git.md
Migrate From SVN To GIT
@mrchnk
mrchnk / aria2
Last active November 11, 2016 04:56 — forked from andrzejressel/aria2
init.d file for aria2c daemon (debian)
#!/bin/sh
### BEGIN INIT INFO
# Provides: aria2
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: aria2c init script.
@echo off
setlocal
set "Reg32=%SystemRoot%\System32\reg.exe"
if not "%ProgramFiles(x86)%"=="" "Reg32=%SystemRoot%\SysWOW64\reg.exe"
for /F "usebackq skip=1 tokens=1,2*" %%T in (`%Reg32% query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "{374DE290-123F-4565-9164-39C4925E467B}" 2^>nul`) do (
if /I "%%T"=="{374DE290-123F-4565-9164-39C4925E467B}" (
set "DownloadShellFolder=%%V"
goto GetDownloadDirectory