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
class DynamicArrayQueue { | |
constructor() { | |
this._arr = []; | |
} | |
enqueue(item) { | |
this._arr.push(item); | |
} | |
dequeue() { |
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
interface Queue extends Iterable<any>{ | |
enqueue(item: any): void; | |
dequeue(): any; | |
clear(): void; | |
size(): number; | |
peekFirst(): any; | |
peekLast(): any; | |
copyTo(arr: any[], startIndex?: number): void | |
drainingIterator(): Iterator<any>; | |
toJSON(): any[]; |
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
interface Queue { | |
enqueue(item: any): void; | |
dequeue(): any; | |
} |
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
morgan.token('remote-addr', function (req, res) { | |
var ffHeaderValue = req.headers['x-forwarded-for']; | |
return ffHeaderValue || req.connection.remoteAddress; | |
}); |
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
// note: -D_7ZIP_ST is required when compiling on non-Windows platforms | |
// g++ -o lzma_sample -std=c++14 -D_7ZIP_ST lzma_sample.cpp LzmaDec.c LzmaEnc.c LzFind.c | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <memory> | |
#include "LzmaEnc.h" | |
#include "LzmaDec.h" |
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 | |
from itertools import zip_longest | |
from traceback import print_exc | |
def grouper(iterable, n, fillvalue=None): | |
"""Collect data into fixed-length chunks or blocks""" | |
# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx" | |
args = [iter(iterable)] * n | |
return zip_longest(*args, fillvalue=fillvalue) |
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 * as request from "superagent"; | |
export class TokenExtractMiddleware { | |
constructor() { | |
} | |
extract = (req, res, next) => { | |
const url = `${process.env.AUTH_SERVICE}/auth/authenticate`; |
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
class hn_wrapper(object): | |
def __init__(self, it): | |
self.it = iter(it) | |
self._hasnext = None | |
def __iter__(self): return self | |
def next(self): | |
if self._hasnext: | |
result = self._thenext | |
else: | |
result = next(self.it) |
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
private static void enableGzipIfNeeded(spark.Request request, spark.Response response) { | |
String accept = request.headers("Accept-Encoding"); | |
if (accept == null) { | |
return; | |
} | |
String[] tokens = accept.split(","); | |
if (Arrays.stream(tokens).map(String::trim).anyMatch(s -> s.equalsIgnoreCase("gzip"))) { | |
response.header("Content-Encoding", "gzip"); | |
} | |
} |
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
https://8gwifi.org/RSAFunctionality?keysize=512 | |
-----BEGIN PUBLIC KEY----- | |
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKanYhwoySc0JjNjqT21f+4hXP+e1g1h | |
dz9wNj0XHii1luZtn8ydFRpzMF5CgECYO4jHMbuB2ZnPXU6Ar7t57HMCAwEAAQ== | |
-----END PUBLIC KEY----- | |
-----BEGIN RSA PRIVATE KEY----- | |
MIIBOQIBAAJBAKanYhwoySc0JjNjqT21f+4hXP+e1g1hdz9wNj0XHii1luZtn8yd | |
FRpzMF5CgECYO4jHMbuB2ZnPXU6Ar7t57HMCAwEAAQJACcZfls89nTMN2o3J63it |