This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.atomic.AtomicInteger | |
interface IController { | |
fun handle(request: AtomicInteger) | |
} | |
fun createController(handler: (request: AtomicInteger) -> Unit): IController { | |
return object : IController { | |
override fun handle(request: AtomicInteger) = handler(request) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require('crypto'); | |
/* | |
msg_key_large = SHA256 (substr (auth_key, 88+x, 32) + plaintext + random_padding); | |
msg_key = substr (msg_key_large, 8, 16); | |
sha256_a = SHA256 (msg_key + substr (auth_key, x, 36)); | |
sha256_b = SHA256 (substr (auth_key, 40+x, 36) + msg_key); | |
aes_key = substr (sha256_a, 0, 8) + substr (sha256_b, 8, 16) + substr (sha256_a, 24, 8); | |
aes_iv = substr (sha256_b, 0, 8) + substr (sha256_a, 8, 16) + substr (sha256_b, 24, 8); | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
int main(int argc, char *argv[]) { | |
long size = 36L * 1024 * 1024 * 1024 - 1; | |
void *x = malloc(size); | |
printf("Malloc: %lld\n", (long long) x); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export { getResult }; | |
function getResult() { | |
return 42; | |
} | |
// If you uncomment this, HRM in `main.js` will stop work and `getResult()` will return 42 everytime | |
//if (module.hot) module.hot.accept(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
const IGNORE_URLS = [ | |
/^\/..\/blog/, | |
]; | |
const TIMEOUT = 30000; | |
let framesPool = new Pool({ | |
maxCount: 4, | |
maxCountForSlow: 8, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const wialon = require('./wialon.node.js').wialon; | |
// Print message to log | |
function msg(text) { console.log(text); } | |
function init() { // Execute after login succeed | |
var sess = wialon.core.Session.getInstance(); // get instance of current Session | |
// flags to specify what kind of data should be returned | |
var flags = wialon.item.Item.dataFlag.base | wialon.item.Unit.dataFlag.lastMessage; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let playButton = document.createElement('button'); | |
playButton.textContent = 'Play'; | |
document.body.appendChild(playButton); | |
playButton.addEventListener('click', () => { | |
let audioCtx = new AudioContext(); | |
let sampleRate = audioCtx.sampleRate; | |
let totalSeconds = 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export { Xoroshiro128Plus }; | |
function Xoroshiro128Plus(options) { | |
let { state } = options || {}; | |
if (!state) { | |
let time = (Date.now() | 0) >>> 0; | |
state = [ | |
(time & ((Math.random() * 0xffffffff) | 0)) >>> 0, | |
(time & ((Math.random() * 0xffffffff) | 0)) >>> 0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local bit = require "bit" | |
local _M = {} | |
local maxInt = 2147483647 | |
local base = 36 | |
local tMin = 1 | |
local tMax = 26 | |
local skew = 38 | |
local damp = 700 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PIN_PEDAL_ANALOG A0 | |
#define PIN_LED 8 | |
#define MIN_LEVEL 590 | |
#define MAX_LEVEL 620 | |
bool pedalEnabled = false; | |
void setup() { | |
pinMode(PIN_LED, OUTPUT); |