Skip to content

Instantly share code, notes, and snippets.

@ilio
ilio / Dockerfile
Created April 8, 2023 19:32
qnap QBoat Sunny web camera rtsp
FROM debian
RUN apt update && apt install -y tzdata; \
apt clean;
# sshd
RUN mkdir /var/run/sshd; \
apt install -y openssh-server; \
sed -i 's/^#\(PermitRootLogin\) .*/\1 yes/' /etc/ssh/sshd_config; \
sed -i 's/^\(UsePAM yes\)/# \1/' /etc/ssh/sshd_config; \
apt clean;
@ilio
ilio / package.json
Created December 18, 2018 17:14
use babel with node v10, all config in package.json
{
"scripts": {
"build": "babel src/ -d bin",
"build watch": "babel src/ -d bin --watch"
},
"devDependencies": {
"@babel/preset-env": "^7.2.0",
"@babel/cli": "^7.2.0",
"@babel/core": "^7.2.0"
},
@ilio
ilio / _desktop_app_on_chromium.md
Last active August 15, 2018 21:31
Standalone desktop app with JavaScript, Html, Css based on latest chromium with puppeteer

Create a standalone desktop app with puppeteer example.

  1. Run npm i
  2. Run node app

For run this example without installation, run in console:
npx https://gist.github.com/ilio/6f4239b60b84a918ab500e2e0528c094

@ilio
ilio / React-PropTypes-to-prop-types.js
Last active September 18, 2021 00:23 — forked from zkat/index.js
React-PropTypes-to-prop-types
#!/usr/bin/env node
console.log('v6', process.argv, process.cwd(), __dirname);
const {exec} = require('child_process');
const path = require('path');
exec('npm bin', {cwd: __dirname}, (err, stdout, stderr) => {
if (err) {
console.error(err);
} else {
@ilio
ilio / app.js
Last active July 19, 2018 21:48
Material Design calendar range select. Result: https://jsfiddle.net/jsbot/cygtdLj3/13/
const Day = ({value, className})=> (
<div className={"day"+(className? ' ' + className: '')}>
<div className="selected" />
<div className="secondary" />
<div className="value">{value}</div>
</div>
);
class Calendar extends React.Component {
state = {
function runNpmInstall() {
return new Promise((resolve, reject) => {
let cmd = 'npm';
if (os.platform() === 'win32') {
cmd += '.cmd';
}
npmProcess = spawn(cmd, ['install'], {cwd: path.join(__dirname, 'service_')});
npmProcess.on('error', e => {
npmProcess = null;
@ilio
ilio / copyRecursive.js
Created June 10, 2018 18:38
node copy files recursive async
awaitable = (func, ...args) => {
return new Promise(resolve => {
func.apply(this, [...args, (...a) => {
if(a.length === 1){
return resolve(a[0]);
}
if(a.length === 2){
return resolve(a[1]);
}
return resolve(a);
@ilio
ilio / nodejsScanPorts.js
Last active April 3, 2018 21:24
node.js scan open ports
// based on https://github.com/baalexander/node-portscanner/blob/master/lib/portscanner.js
const {Socket} = require('net');
function connect(port, host, timeout, callback) {
let connectionRefused = false;
const socket = new Socket();
let status = null;
let error = null;
@ilio
ilio / es6-js-snippets.md
Last active September 28, 2017 20:51
js/es6 snippets

es6/js snippets

sudo su -l