Skip to content

Instantly share code, notes, and snippets.


Matīss Addvilz

View GitHub Profile
View gist:438dd29c50222eca1b20186a79c15154
db.currentOP().inprog.forEach(function(v){if (v.op == "query") { db.killOP(v.opid);}});
View openjdk
# Download tar.gz and then update-alternatives --config java and choose appropriate slot.
update-alternatives --install /usr/bin/java java /opt/openjdk/openjdk-11-ea+9_linux-x64_bin/jdk-11/bin/java SLOT
update-alternatives --config java
# Also gradle
update-alternatives --install /usr/bin/gradle gradle /opt/gradle/gradle-4.6/ 1
# Also maven
update-alternatives --install /usr/bin/mvn mvn /opt/maven/apache-maven-3.5.3/bin/mvn 1
View genesis_public_key
Addvilz /
Created Sep 6, 2017 — forked from andrequeiroz/
Implementation of Holt-Winters algorithms in Python 2
#The MIT License (MIT)
#Copyright (c) 2015 Andre Queiroz
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
Addvilz /
Created Jun 25, 2017 — forked from ilmich/
Java NIO tcp tunnel
package ctptunnel;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.HashMap;
View gist:422554edb7734260df232adc6e98982b
The initial MVP did not have the timetracker and users had to create their own invoices. This proved to be the biggest
problem freelancers wanted solved, so a timetracker was implemeneted.
Users noticed that the timetracker would not persist if the browser was closed. Users requested a persistent timetracker, that would not
stop until the user clicks "stop"
Addvilz / gist:aebef1637cf8d3da8b70
Created Jul 22, 2015
Exploiting auth system without feedback to determine username presence
View gist:aebef1637cf8d3da8b70
var inputUsername
var inputPassword
user = retrieve from storage with matching inputUsername
if user not exists
return 'No matching user'
if user.password not match hash(inputPassword)
return 'No matching user'
View proscript.pros.js
namespace Hello.World
import Iterator
import List
import LinkedList as BaseList
import Map
import OtherInterface
const EXCL_MARK is '!'
View gist:f3e3264ade39e88e6069
* I would rather solve this problem by having a Entity, a dumb business model that contains
* all the data, is dumb (yep), has no logic and represents a data type.
* Populate it once and reuse the type where applicable, as it will give many advantages against
* having to juggle around bazillion of separate variables.
* a) your business logic and data will be clearly separated - SOC;
* b) KISS DRY;
Addvilz / gist:5f7604224ce0238af7fd
Created Mar 6, 2015
phpstorm setter with self reference and correct type hints
View gist:5f7604224ce0238af7fd
## Editor>File and Code Templates>Code>PHP Setter Method
#set($typeHintText = "$TYPE_HINT ")
## First we check against a blacklist of primitive and other common types used in documentation.
#set($nonTypeHintableTypes = ["", "string", "int", "mixed", "number", "void", "object", "real", "double", "float", "resource", "null", "bool", "boolean"])
#foreach($nonTypeHintableType in $nonTypeHintableTypes)
#if ($nonTypeHintableType == $TYPE_HINT)
#set($typeHintText = "")
## Make sure the type hint actually looks like a legal php class name(permitting namespaces too) for future proofing reasons.
You can’t perform that action at this time.