Skip to content

Instantly share code, notes, and snippets.

View Addvilz's full-sized avatar

Matīss Addvilz

View GitHub Profile
@Addvilz
Addvilz / gist:438dd29c50222eca1b20186a79c15154
Created September 9, 2019 09:01 — forked from joachimkainz/gist:1357460
kill all queries in mongo
db.currentOP().inprog.forEach(function(v){if (v.op == "query") { db.killOP(v.opid);}});
@Addvilz
Addvilz / holtwinters.py
Created September 6, 2017 16:53 — forked from andrequeiroz/holtwinters.py
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
Addvilz / tcptunnel.java
Created June 25, 2017 15:29 — forked from ilmich/tcptunnel.java
Java NIO tcp tunnel
package ctptunnel;
import java.io.IOException;
import java.net.InetSocketAddress;
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;
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"
<?php
/**
* 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;