Skip to content

Instantly share code, notes, and snippets.

@koteq
koteq / ruble_format.php
Last active September 8, 2016 12:58
Ruble format #currency #money
<?php
/**
* Formats a number as a ruble currency string for web.
*
* @param float $number The number to be formatted.
* @param int $decimals [optional]
* @param boolean $trim_zero_decimals [optional]
* @param boolean $add_currency_suffix [optional]
* @return string A formatted version of number.
@koteq
koteq / App.java
Created September 14, 2015 15:57
Teh MVC... kind of
public class App {
public static void main(String[] args) {
NumberModel model = new NumberModel();
NumberController controller = new NumberController(model);
}
}
@koteq
koteq / git-ls-dublicates.sh
Created December 12, 2015 19:29
git wrong case dublicates
git ls-files | sort -f | uniq -cid | wc -l
@koteq
koteq / mal-season-friends-watching.user.js
Created April 14, 2016 22:27
MAL Season Friends Watching
// ==UserScript==
// @name MAL Season Friends Watching
// @version 1.0
// @match http://myanimelist.net/anime/season
// @grant none
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.min.js
// @require https://cdn.rawgit.com/patik/within-viewport/1.0.0/withinviewport.js
// @require https://cdn.rawgit.com/patik/within-viewport/1.0.0/jquery.withinviewport.js
// @require https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js
// ==/UserScript==
@koteq
koteq / ht2000 pool to json.py
Last active June 28, 2016 11:39
ht2000 ht-2000 co2 monitor pooler
import os
import json
import time
from struct import unpack_from
from datetime import datetime
import usb.core
import usb.backend.libusb1
@koteq
koteq / qbittorrent web api add torrent (utorrent).pyw
Created July 10, 2016 00:23
Adapter to pair Taiga with qBittorrent
#!/usr/bin/env python3
import os
import sys
import argparse
# pip install requests
import requests
def main():
// ==UserScript==
// @version 1.0
// @name Pixiv Top
// @description Load 7 pages and order it by bookmarks count
// @match *://www.pixiv.net/search.php*
// @grant none
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.1/jquery.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.15.0/lodash.min.js
// ==/UserScript==
@koteq
koteq / myanimelist people you may know.js
Created November 25, 2016 19:26
Parses friends of your friends and show you links profiles with people you may know. Usage: open your friends page, open dev tools, copypaste the script to console, press enter and wait. You may watch the downloading process on networks tab.
const DEPTH = 2; // 1 is usless, 3 is insane
const PROFILE_RE = /profile\/(.*?)(?:\/|$)/;
const SELF_PROFILE_RE = /profile\/(.*?)\/friends/;
const PROFILE_URL = 'https://myanimelist.net/profile/{profile}';
const FRIENDS_URL = 'https://myanimelist.net/profile/{profile}/friends';
function promiseWhile(condition, action) {
return new Promise((resolve, reject) => {
function loop() {
if (!condition()) {
// ==UserScript==
// @name G+ two columns mode
// @version 0.1
// @match https://plus.google.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
window.innerWidth = 1200;
@echo off
:: WARNING: after some testing considered as not recommended.
:: Filter to keep only non similar frames.
:: It selects only first frame `eq(n\,0)`
:: and frames with differences `gt(scene\,{sensivity})`
:: see https://ffmpeg.org/ffmpeg-filters.html#select_002c-aselect
set similar_frames_sensivity=0.002
set skip_similar_frames=select=eq(n\,0)+gt(scene\,%similar_frames_sensivity%)
:: Adaptive Temporal Averaging Denoise.