Skip to content

Instantly share code, notes, and snippets.

View bb authentication
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC2NxoD8XcARl7bau1/HqeZkeRqNvOJJ+e1RpU1rtVjwuM0FRvN/JCWA/tAJN+PfTPydUPS4RR3fv4BWyhS3aS4Ap6wU1EMsSCu5hepRwv8hwleWK+G3kf+gOY/H3Zv95zI6hdRyGYfcvFpm6gBhrIzk11blySsZQs9tLGCaObOk8kyaheyS6UIcFb+clXxY+0MUv92BRPXQ8AAatwLdj0PxlaEWJXTPzoIvascy6GhcuqQDD8lix8zdYQDPW8yW8bZOdEmeNOxLceqHP4IuRs2cQ8Y0qvwnfDndg9lVq4jOqUvah5G5Cb/0v57EURQrQLW5EzvhJ9aTJZZFRkeZxQL1kh0yJ1bnrJ27vyeP7iDaap34AYyYp9NKOIpG+5gHre1q7wCrlq1QBExo28s0/+SykMoryKE9OwBFHK0EpA3CxeOxEDov9jVKeomAcK3dFukSy8IM5nN2+PblicAW8AFl1dcnS41IWfg1kYpxhNHn4++ImVBqWDRuB5DpAUQslD7YpVdescE6pic3/48u6r9t8rJQf9kPirrUjnndzUPmqc6SIJLpRf9nuEVSbyXkO3heX9y6I8pCpYIw2eo6E82ub11FPywOCJYV6ReVD1cNLsw23GKDF6uN5/KPFwy5sD5Ezv3pfNjNopnltizagUhJNyKr6m84fLiuGXQf4dEgw== vd@hp
@dvv
dvv / Cheque.java
Last active Apr 25, 2020
Fetch russian shopping cheque contents by its qrcode
View Cheque.java
package vd.myhome.cheque;
import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.TextView;
import com.android.volley.AuthFailureError;
View irrecv.js
const from_Myhome_to_NEC = (x) => {
const s = Number(x).toString(2).split("").reverse();
while (s.length < 32) s.push("0");
return parseInt(s.join(""), 2).toString(16);
}
/*
0xdb24f708 => 10ef24db
*/
@dvv
dvv / rand.c
Created Mar 20, 2018
c random uint32_t generator
View rand.c
uint32_t _rand(void)
{
static uint32_t Z;
if (Z & 1) {
Z = (Z >> 1);
} else {
Z = (Z >> 1) ^ 0x7FFFF159;
}
return Z;
}
View koa-reload.js
// -----------------------------------------------------------------------------
// Server
// -----------------------------------------------------------------------------
var listen = function () {
var server = HTTP.createServer();
server.listen(process.env.PORT || 8000, "0.0.0.0", function () {
console.log(`Starting HTTP server on ${this._connectionKey}...`);
function attach() {
app.middleware = require("./stack");
@dvv
dvv / grab.py
Created Apr 27, 2015
1torrenttv playlist rip
View grab.py
#!/usr/bin/env python2
import sys
import urllib
from HTMLParser import HTMLParser
import json
import time
import random
cats = dict()
@dvv
dvv / codec.lua
Last active Aug 29, 2015
AE info encode
View codec.lua
local M
do
-- cache
local char = string.char
--
local encode_info = function(args)
local r = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -- FIXME: lowlevel createtable with 8 + 2 * #args elements?
local n = 0
-- enlist arguments separated with NL
for i = 1, #args do
@dvv
dvv / pub.lua
Created Mar 10, 2015
Nginx redis comet
View pub.lua
------------------------------------------------------------------------------
-- Redis publication
--
-- LICENCE: http://opensource.org/licenses/MIT
-- Vladimir Dronnikov <dronnikov@gmail.com>
------------------------------------------------------------------------------
local db = assert(require("resty.redis"):new())
db:set_timeout(1000) -- 1000 sec
assert(db:connect("127.0.0.1", 6379))
@dvv
dvv / justo.lua
Last active Dec 28, 2015
Lua perf measurement
View justo.lua
#!/usr/bin/env le-lua-interpreter
if #arg < 1 then
-- TODO: help
os.exit(1)
end
local DEFAULT_ITERATIONS = 1e6
local bench_file = arg[1]
@dvv
dvv / test.js
Created Aug 13, 2013
Test for unitecontrol
View test.js
for (var i = 1; i <= 100; ++i) {
var i3 = (i % 3) === 0;
var i5 = (i % 5) === 0
var r = i;
if (i3 && i5) {
r = 'MissKiss';
} else if (i3) {
r = 'Miss';
} else if (i5) {
r = 'Kiss';