Skip to content

Instantly share code, notes, and snippets.

@DorianRudolph
DorianRudolph / LICENSE.txt
Last active January 4, 2024 03:36
Arduino PS2 to USB HID Keyboard Converter
Copyright (c) 2015, Dorian Rudolph
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@gdamjan
gdamjan / init.lua
Last active August 29, 2015 14:13
irc in lua for the esp8266 with nodemcu -- https://github.com/nodemcu/nodemcu-firmware
function connect_callback(conn)
conn:send("NICK esp8266_hacklab\r\n")
conn:send("USER esp8266_hacklab 8 * :Heeelloooo\r\n")
conn:send("JOIN #lugola\r\n")
conn:send("PRIVMSG #lugola :здраво свет\r\n")
end
function receive_callback(conn, payload)
print(payload)
if string.find(payload, "PING :") == 1 then
@rodricios
rodricios / summarize.py
Last active November 18, 2020 17:21
Flipboard's summarization algorithm, sort of
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pip install networkx distance pattern
In Flipboard's article[1], they kindly divulge their interpretation
of the summarization technique called LexRank[2].
@montanaflynn
montanaflynn / proxy.go
Last active January 17, 2021 15:37
Golang reverse proxy
package main
import (
"log"
"net/http"
"net/http/httputil"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
Interconnect: LAN(1GB)
Server: 12 core Xeon E5-2620 at 2Ghz, 16GB RAM
Client running on idle node with similar h/w configuration. Used latest wrk2 release
https://github.com/giltene/wrk2
Tried different configuration options, results for configuration that gave best results
See also: https://gist.github.com/markpapadakis/dee39f95a404edfb8d6c
# Apache2: http://10.5.5.20/index.html
Requests/sec: 83704.15
> More or less expected that kind of throughput
- responding with a file that contains 'Hello World'
- Using latest releases of all benchmarked web servers
- selected because of claims/benchmarks made wrt to their performance/speed
- HTTPSrv is using the same configuration (number of threads, responds with a similar file)
- tried differnet configs. for lhttd but still really slow
- Using a 12 cores node, at 2Ghz, 16GB of RAM (rougly x2 slower than system used in test in that page)
- Except nginx, other web servers tested with default configuration(nginx with default settings ran slower)
- Clearly, g-web claims are valid. Faster by a wide margin than all other HTTP servers in this simple test case
(except our optimized HTTPSrv, which, though, is built to support a minimal features-set
and its only real use here is serving static files, and, optionally, resizing images before

Nginx vs h2o (http/1.1)

Environment

WebServer

  • AWS EC2 c3.xlarge(ap-northeast-1a)
  • cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
@kjmkznr
kjmkznr / benchmark.md
Last active July 18, 2016 17:58
using lwan from golang

benchmark result

EC2 m3.medium / Gentoo Linux

go version go1.3.3 linux/amd64

$ ./wrk http://localhost:8081/hello
Running 10s test @ http://localhost:8081/hello
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
@drott
drott / bbmonitor
Created September 29, 2014 12:35
USB WebKit Buildbot monitor
#!/usr/bin/python2
#
# Buildbot monitor
# Author: Leandro A. F. Pereira <leandro@profusion.mobi>
#
# Copyright (C) 2010 ProFUSION Embedded Systems
#
import urllib
import BeautifulSoup
@suxue
suxue / WebSocketServer.sh
Created March 16, 2014 11:52
simple WebSocket Server make use of netcat
#!/bin/ksh
typeset port=$((RANDOM % 60000))
while ((port < 30000)); do
port=$((RANDOM % 60000))
done
typeset pipe=`mktemp -u`
mkfifo $pipe
trap "rm -f $pipe" INT