This file contains 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 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 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 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 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 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 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
(defn id (x) x) | |
(defn inRange (c start end) (and (>= (ord c) (ord start)) (<= (ord c) (ord end)))) | |
(defn tryParse (pattern text) | |
(let (patternType (head pattern)) | |
(switch patternType | |
'single' (let | |
(parser (get 1 pattern) | |
handler (getOrDef id 2 pattern) |
This file contains 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 sys | |
numbers = [2, 0, 1, 5, 2, 0, 1, 5] | |
k = len(numbers) - 1 | |
indexed_tail = list(zip(range(k), numbers[1:])) | |
to_bin = 2 ** k - 1 | |
variants = [] |
This file contains 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 showLobby(session) { | |
var lobby = new LobbyClient({session: session}); | |
var lobbyUi = new LobbyUi({element: rootElement}); | |
var processLobbyEventsUntilNotJoinRoom = lobbyUi.poll().bind(function(event) { | |
if (event.type === LobbyUi.EVENTS.JOIN_ROOM) { | |
this.cont(null, event.id); | |
} else { | |
return processLobbyEventsUntilNotJoinRoom; | |
} |
This file contains 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 System.IO | |
import Control.Monad | |
whileFM :: (Monad m) => m Bool -> (s -> m s) -> s -> m s | |
whileFM b f s = b >>= while' where | |
while' False = return s | |
while' True = (f s) >>= (\newS -> whileFM b f newS) | |
andM :: (Monad m) => m Bool -> m Bool -> m Bool | |
andM a b = a >>= (\x -> |