Skip to content

Instantly share code, notes, and snippets.

@nadavrot
nadavrot / Matrix.md
Last active June 21, 2024 02:33
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@JonasGao
JonasGao / proxy.minimal.conf
Last active January 25, 2023 22:22 — forked from sirsquidness/proxy.conf
How to have nginx proxy_pass follow upstream 302 redirects (Minimal, without Cache
server {
listen 80;
charset utf-8;
location / {
proxy_pass http://web;
proxy_intercept_errors on;
error_page 301 302 307 = @handle_redirects;
}
@eed3si9n
eed3si9n / sbt-plugin-ranking-2017-08-05.md
Last active June 8, 2018 09:15 — forked from xuwei-k/sbt-plugin-ranking-2014-02-25
List of sbt plugins sorted by GitHub stars. This was generated using https://gist.github.com/eed3si9n/ea4ceef0c5e5c07d6e62c87bea029f88, then augmented by hand.
@cmk
cmk / free_monad_interpreter_pattern.md
Created January 2, 2017 22:30 — forked from CMCDragonkai/free_monad_interpreter_pattern.md
Haskell: Free Monad + Interpreter Pattern

Free Monad + Interpreter Pattern

It's like creating the front end and back end of a compiler inside Haskell without the need of Template Haskell!

Write your DSL AST as a Free Monad, and then interpret the monad any way you like.

The advantage is that you get to swap out your interpreter, and your main code

@prasanthj
prasanthj / native-mem-tracking.md
Last active June 5, 2024 12:48
Native memory tracking in JVM

Enable native memory tracking in JVM by specifying the following flag

-XX:NativeMemoryTracking=detail

Know the <PID> of the java process

jps

To print ps based RSS

ps -p <PID> -o pcpu,rss,size,vsize

To print native memory tracking summary

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@ThomasLau
ThomasLau / ThriftClient
Last active August 29, 2015 14:27 — forked from roymax/ThriftClient
grizzly-thrift
public void testGrizzly(String ip, int port) throws IOException, InterruptedException, ExecutionException, TimeoutException, TException {
// init client
final FilterChainBuilder clientFilterChainBuilder = FilterChainBuilder.stateless();
clientFilterChainBuilder.add(new TransportFilter());
// clientFilterChainBuilder.add(new ThriftFrameFilter());
clientFilterChainBuilder.add(new ThriftClientFilter());
final TCPNIOTransportBuilder builder = TCPNIOTransportBuilder.newInstance();
final ThreadPoolConfig config = builder.getWorkerThreadPoolConfig();
@CMCDragonkai
CMCDragonkai / free_monad_interpreter_pattern.md
Last active June 7, 2021 01:35
Haskell: Free Monad + Interpreter Pattern

Free Monad + Interpreter Pattern

It's like creating the front end and back end of a compiler inside Haskell without the need of Template Haskell!

Write your DSL AST as a Free Monad, and then interpret the monad any way you like.

The advantage is that you get to swap out your interpreter, and your main code

var fs = require('fs');
var path = require('path');
var http = require('http');
var https = require('https');
var app = require('express')();
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var multer = require('multer');
var session = require('express-session');
@ryancdotorg
ryancdotorg / rsabd.py
Last active March 13, 2023 15:57
backdoored rsa key generation
#!/usr/bin/env python
import sys
import gmpy
import curve25519
from struct import pack
from hashlib import sha256
from binascii import hexlify, unhexlify