Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <cmath>
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// GLFW
#include <GLFW/glfw3.h>
<!DOCTYPE HTML>
<html lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Zooming via HTML5 Canvas Context</title>
<style type="text/css" media="screen">
body { background:#eee; margin:1em; text-align:center; }
canvas { display:block; margin:1em auto; background:#fff; border:1px solid #ccc }
</style>
</head><body>
@huawww
huawww / array2buffer.js
Created October 5, 2016 22:17
Array <-> Buffer
// From Buffer to ArrayBuffer:
utils.toArrayBuffer = function toArrayBuffer(buffer) {
var ab = new ArrayBuffer(buffer.length);
var view = new Uint8Array(ab);
for (var i = 0; i < buffer.length; ++i) {
view[i] = buffer[i];
}
return ab;
}
@huawww
huawww / 01_files.config
Created October 13, 2016 07:55
.ebextensions/01_files.config
files:
"/etc/nginx/conf.d/proxy.conf" :
mode: "000755"
owner: root
group: root
content: |
client_max_body_size 100M;
@huawww
huawww / Dockerfile
Created October 13, 2016 07:56
docker file example
FROM busybox
ADD . /
CMD ["/IfcHandler"]
EXPOSE 3000
@huawww
huawww / browser.js
Created October 17, 2016 10:32
socket-io, socket-io-stream
// client(browser)
import io from 'socket.io-client';
import ss from 'socket.io-stream';
socket.on('connect', function(){
console.log('client:', socket.id, socket);
const options = {
headers:{
'Content-Type':'image/svg+xml',
}
   /bin       Essential command binaries
   /boot      Static files of the boot loader
   /dev       Device files
   /etc       Host-specific system configuration
   /lib       Essential shared libraries and kernel modules
   /media     Mount point for removeable media
   /mnt       Mount point for mounting a filesystem temporarily
   /opt       Add-on application software packages
   /sbin      Essential system binaries

/srv Data for services provided by this system

@huawww
huawww / ssl.config
Created December 14, 2016 11:30
enable https on single instance aws-eb
# https://keithpblog.wordpress.com/2015/04/13/scaling-down-to-single-instance-elastic-beanstalk/
# .ebextensions/ssl.config
Resources:
sslSecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: example_id
IpProtocol: tcp
ToPort: 443
eb create dev-env -p "64bit Amazon Linux 2014.09 v1.1.0 running Ruby 2.1 (Puma)" --single -i t2.micro --envvars key1=value1,key2=value2...
@huawww
huawww / fetch.sh
Created December 16, 2016 08:29
get all shared objects
ldd file | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp -v '{}' /destination