Skip to content

Instantly share code, notes, and snippets.

@cs8425
cs8425 / gist:2383514
Created April 14, 2012 10:47
2bit_to_8LED
module led8( select, d );
input[2:0] select;
output[7:0] d;
wire[2:0] select;
reg[7:0] d;
always @( select or d )
begin
@cs8425
cs8425 / mux4.v
Created April 14, 2012 11:08
mux4
module mux4( d, s, y );
input [3:0]d;
input [1:0]s;
output y;
wire [3:0]d;
wire [1:0]s;
wire y;
assign y= (s == 2'b00)? d[0]: (s == 2'b01)? d[1]: (s == 2'b10)? d[2] : d[3];
@cs8425
cs8425 / gist:2383629
Created April 14, 2012 11:10
gate2to4
module xbox( a, o );
input [1:0]a;
output [3:0]o;
assign o = 4'b0001 << a ;
endmodule
@cs8425
cs8425 / gist:7869055
Created December 9, 2013 08:25
M-JPG http header
http://stackoverflow.com/questions/2060953/httpwebresponse-with-mjpeg-and-multipart-x-mixed-replace-boundary-myboundary
var BOUNDARY = '----' + Math.random().toString(16).substring(2);
header("Cache-Control: no-cache");
header("Cache-Control: private");
header("Pragma: no-cache");
header("Content-type: multipart/x-mixed-replace; boundary=$boundary");
============================
HTTP/1.1 200 OK
Content-Type: multipart/x-mixed-replace; boundary=--myboundary
@cs8425
cs8425 / proxy.js
Last active October 3, 2015 05:46
simple http to https proxy (with ws)
var fs = require('fs');
var http = require('http');
var https = require('https');
var httpProxy = require('http-proxy');
http.globalAgent.maxSockets = 10000;
https.globalAgent.maxSockets = 10000;
var options = {
https: {
@cs8425
cs8425 / 7zb
Last active October 13, 2015 19:19
7-zip benchmark on ZenFone 2 (4G/64G) with chroot
cs8425@localhost:~$ 7z b
7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)
RAM size: 3907 MB, # CPU hardware threads: 4
RAM usage: 850 MB, # Benchmark threads: 4
Dict Compressing | Decompressing
Speed Usage R/U Rating | Speed Usage R/U Rating
@cs8425
cs8425 / app.js
Last active November 23, 2015 17:47
/*
"name": "express",
"version": "4.12.3",
"name": "socket.io",
"version": "1.3.5",
*/
var express = require('express');
var http = require('http');
var app = express();
@cs8425
cs8425 / 7zb
Created December 8, 2015 09:21
scaleway
7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)
RAM size: 2023 MB, # CPU hardware threads: 4
RAM usage: 850 MB, # Benchmark threads: 4
Dict Compressing | Decompressing
Speed Usage R/U Rating | Speed Usage R/U Rating
KB/s % MIPS MIPS | KB/s % MIPS MIPS
@cs8425
cs8425 / key.sh
Created January 11, 2016 06:55
golang simple tcp/tls proxy
# wrok like:
#
# raw tcp(9999) tls(127.0.0.1:25500) raw tcp(25501)
# client =============> tcp2tls_client.go =====================> tls2tcp_server.go ==============> real server
#Generated private key
openssl genrsa -out server.key 2048
#To generate a certificate
@cs8425
cs8425 / keyemu.go
Last active February 1, 2024 15:26
simple keyboard & mouse binding over web in golang
// build:
// GOOS=windows GOARCH=386 go build -o keyemu.exe keyemu.go
// GOOS=windows GOARCH=amd64 go build -o keyemu-x64.exe keyemu.go
// pre-build: https://mega.nz/#F!c9M0VaqK!sjUh5jwAU1tYkVv8z9YqaQ
// ref: https://github.com/micmonay/keybd_event
package main