Skip to content

Instantly share code, notes, and snippets.

# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
i
me
my
myself
we
our
ours
ourselves
you
your
@monperrus
monperrus / Apriori.java
Last active August 11, 2023 11:22
Java implementation of the Apriori algorithm for mining frequent itemsets
import java.io.*;
import java.util.*;
/** The class encapsulates an implementation of the Apriori algorithm
* to compute frequent itemsets.
*
* Datasets contains integers (>=0) separated by spaces, one transaction by line, e.g.
* 1 2 3
* 0 9
* 1 9
@3rd-Eden
3rd-Eden / README.md
Last active January 4, 2021 10:20
Protecting against POODLE in node.js

[Google recently announced][poodle] that there is an exploit in SSLv3, this vulnerability is know as POODLE. There is no other option than to disable SSLv3 in order to combat this major flaw. There have already been [guides on how to disable this in different servers][guides]. But nothing excised for Node.js yet, until now. In order to resolve this for Node.js we need to use various of undocumented options and modules.

In the index.js file below you can see an example of how you can protect your HTTPS server against the POODLE attack. It uses the secureOptions option to pass in constants in to the SSL context which is created by node.

@JonCole
JonCole / ThreadPool.md
Last active March 6, 2024 05:03
Intro to CLR ThreadPool Growth

ThreadPool Growth: Some Important Details

The CLR ThreadPool has two types of threads - "Worker" and "I/O Completion Port" (aka IOCP) threads.

  • Worker threads are used when for things like processing Task.Run(…) or ThreadPool.QueueUserWorkItem(…) methods. These threads are also used by various components in the CLR when work needs to happen on a background thread.
  • IOCP threads are used when asynchronous IO happens (e.g. reading from the network).

The thread pool provides new worker threads or I/O completion threads on demand (without any throttling) until it reaches the "Minimum" setting for each type of thread. By default, the minimum number of threads is set to the number of processors on a system.

Once the number of existing (busy) threads hits the "minimum" number of threads, the ThreadPool will throttle the rate at which is injects new threads to one thread per 500 milliseconds. This means that if your system gets a burst of work needing an IOCP thread, it will proces

@JonCole
JonCole / DiagnoseRedisErrors-ClientSide.md
Last active January 6, 2020 17:52
Diagnosing Redis errors caused by issues on the client side
#!/bin/bash
# Why? Education & zero redis-cli dependecy
# (it is a shame, however, that this functionality isn't a part of redis-cli... PR on the way)
HOST=127.0.0.1
PORT=6379
if [ $# -lt "2" ]
then
echo "Call a Redis command with its last argument being file contents"
echo "Usage: $0 <Redis command> <keys and arguments for command> <payload>"
@vyznev
vyznev / se_hotness_estimator.user.js
Last active November 3, 2022 00:32
Adds an estimate of "hotness" to the question sidebar, calculated using the formula from http://meta.stackexchange.com/a/61343. Questions with a high hotness value may be selected for the Hot Network Questions list. Note that the hotness value displayed by this script does not include the per-site scaling factors, and so does not match the "arbi…
// ==UserScript==
// @name Stack Exchange hotness estimator
// @namespace http://vyznev.net/
// @description Estimates how highly each Stack Exchange question would rank on the Hot Network Questions list
// @author Ilmari Karonen
// @version 0.4.3
// @license Public domain
// @homepageURL https://meta.stackexchange.com/a/284933
// @downloadURL https://gist.github.com/vyznev/bb2c1adb6e96eb65a87bab3822c74e81/raw/se_hotness_estimator.user.js
// @match *://*.stackexchange.com/questions/*
@kocisov
kocisov / next_nginx.md
Last active April 10, 2024 14:27
How to setup next.js app on nginx with letsencrypt
@jermdavis
jermdavis / Install-Solr.ps1
Last active November 23, 2021 13:30
A PowerShell script to help installing Solr as a service - See https://blog.jermdavis.dev/posts/2017/low-effort-solr-installs for details
Param(
$solrVersion = "6.6.2",
$installFolder = "c:\solr",
$solrPort = "8983",
$solrHost = "solr",
$solrSSL = $true,
$nssmVersion = "2.24",
$JREVersion = "1.8.0_151"
)