Skip to content

Instantly share code, notes, and snippets.

View Rush's full-sized avatar
☺️
Work hard, play hard

Damian Kaczmarek Rush

☺️
Work hard, play hard
View GitHub Profile
{
"error": "Invalid version"
}
@Rush
Rush / memoize-decorator.ts
Last active January 27, 2022 10:18
Using memoizee with observables
import { decorate } from 'core-decorators';
import * as memoize from 'memoizee';
import { duration, unitOfTime } from 'moment';
import { memoizeObservable } from './rxjs';
type HumanDuration = [number, unitOfTime.DurationConstructor];
export interface MemoizeOptions extends memoize.Options {
observable?: boolean;
ttl?: HumanDuration;

Keybase proof

I hereby claim:

  • I am rush on github.
  • I am rushpl (https://keybase.io/rushpl) on keybase.
  • I have a public key ASBSqVg6ydnTE-NIgaCHSJNYvcEJWypd4WLHN-EunskoTQo

To claim this, I am signing this object:

@Rush
Rush / node-https-bug.js
Last active August 29, 2015 14:02
HTTPS connection closed in the middle of request on 0.11.11 and later nodejs/node-v0.x-archive#7733
/*
Issue joyent/node#7733
run this on a remote server and do on your local machine (I have 40ms lag to my server)
you need this image file:
http://x.rushbase.net/da39a3ee5e6b4b0d3255bfef95601890afd80709/codecharm-white.png
wget --no-check-certificate https://yourserver.net:63000/codecharm-white.png
this should yield error on node 0.11.11 and upper and works well o node 0.11.10:
@Rush
Rush / thread_read_test.cpp
Last active August 29, 2015 14:01
C++ threaded read test
#include <thread>
#include <fstream>
#include <vector>
#include <chrono>
#include <sys/stat.h>
#include <iostream>
#include <atomic>
long file_size(const char* file)
{
@Rush
Rush / StripArgsTest
Created May 19, 2014 22:57
C# arguments handling test
using System.Diagnostics;
using System;
class Program
{
public static bool IsRunningOnMono()
{
return Type.GetType ("Mono.Runtime") != null;
}
@Rush
Rush / honor-cipher-order-sni-problem.js
Created March 5, 2014 21:16
There is problem in forcing cipher order with SNI
#!/usr/bin/env node
var tls = require('tls');
var crypto = require('crypto');
function b64decode(encoded) {
return new Buffer(encoded || '', 'base64').toString('utf8');
};
var ciphers = "EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+RC4:EECDH:EDH+aRSA:RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS";
@Rush
Rush / sortobj.js
Last active August 29, 2015 13:55
Sort objects by key
function sortObjectKeys(unsortedObject) {
if(typeof unsortedObject !== 'object')
return unsortedObject;
var sortedObject = {};
Object.keys(unsortedObject).sort().forEach(function(k) {
sortedObject[k] = sortObjectKeys(unsortedObject[k]);
});
return sortedObject;
}
/*
After running this script, please run:
openssl s_client -reconnect -state -prexit -connect localhost:41443 2> /dev/null|grep -P "(New|Reused)"
Needs at least:
> openssl version
OpenSSL 1.0.1e 11 Feb 2013
Expected behaviour: OpenSSL should report all new connections since resumeSession is
returning null session data. Both newSession and resumeSession should
work, although in this setup only newSession should be called.
#!/usr/bin/env node
var spdy = require('spdy'),
crypto = require('crypto'),
fs = require('fs');
b64decode = function(encoded) {
return new Buffer(encoded || '', 'base64').toString('utf8');
};