Skip to content

Instantly share code, notes, and snippets.

View shanehsu's full-sized avatar

徐鵬鈞 shanehsu

  • 閃玩
  • 桃園市、彰化市(Taiwan)
View GitHub Profile
@shanehsu
shanehsu / docker-compose.yaml
Created March 21, 2020 13:59
Samba repro docker
version: '3.4'
services:
samba:
image: dperson/samba
environment:
TZ: 'EST5EDT'
networks:
- default
ports:
// Dependencies:
// npm install request request-promise-native
var request = require('request-promise-native')
request.post('http://120.107.172.236:3000/devices/').then(v => {
console.dir(JSON.parse(v))
}).catch(e => {
console.error(e)
})
let express = require('express');
let router = express.Router();
// route that devices will automatically connect and reqister their current ip:port
router.use('/', (req, res) => {
// Device information object
// {
// serial: <string> product serial number
// mac: <string> mac address of remote device
// ip: <string> ip address
@shanehsu
shanehsu / to_string
Created June 26, 2015 12:23
C++ to_string alternative
#include <sstream>
template <typename T>
std::string to_string(const T& value) {
std::stringstream ss;
ss << value;
return ss.str();
}
int i = 0;
@shanehsu
shanehsu / calculus-chpt9
Created June 12, 2015 19:03
微積分:第九章
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>微積分:第九章</title>
<link rel="stylesheet" href="https://stackedit.io/res-min/themes/base.css" />
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>
</head>
<body><div class="container"><h1 id="第九章">第九章</h1>