with PM2 & Nginx
as a root, run below commands on server:
# adduser tomy
| 'use strict'; | |
| var directives = angular.module('app', []); | |
| // override the default input to update on blur | |
| directives.directive('input', function () { | |
| return { | |
| restrict: 'E', | |
| require: 'ngModel', | |
| link: function (scope, elm, attr, ngModelCtrl) { | |
| if (attr.type === 'radio' || attr.type === 'checkbox') return; |
| [ | |
| ["Windows key","Open or close Start Menu." ], | |
| ["Windows key + A","Open Action center." ], | |
| ["Windows key + C","Open Cortana in listening mode." ], | |
| ["Windows key + D","Display and hide the desktop." ], | |
| ["Windows key + E","Open File Explorer." ], | |
| ["Windows key + G","Open Game bar when a game is open." ], | |
| ["Windows key + H","Open the Share charm." ], | |
| ["Windows key + I","Open Settings." ], | |
| ["Windows key + K","Open the Connect quick action." ], |
| """A little script to recover deleted recording of a mongoDB db file | |
| There's no optimization but it work and has saved me | |
| """ | |
| import struct | |
| import bson | |
| import pymongo | |
| import sys |
| /* require XLSX */ | |
| var XLSX = require('XLSX') | |
| function datenum(v, date1904) { | |
| if(date1904) v+=1462; | |
| var epoch = Date.parse(v); | |
| return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000); | |
| } | |
| function sheet_from_array_of_arrays(data, opts) { |
| import * as Sequelize from "sequelize"; | |
| import uuidv1 = require("uuid/v4"); | |
| import { SequelizeModelStatic } from "./sequelize"; | |
| import * as pLimit from "p-limit"; | |
| import _ = require("lodash"); | |
| /** | |
| * Get generated SQL query from sequelize. Returns a promise that: | |
| * 1. Adds a hook that receives the prepared options from Sequelize | |
| * - Since hooks work on the whole model, |
| SELECT GROUP_CONCAT('kill ',id SEPARATOR '; ') AS kill_list | |
| FROM INFORMATION_SCHEMA.PROCESSLIST | |
| WHERE command='Sleep'; |
| error_page 400 404 405 =200 @40*_json; | |
| location @40*_json { | |
| default_type application/json; | |
| return 200 '{"code":"1", "message": "Not Found"}'; | |
| } | |
| error_page 500 502 503 504 =200 @50*_json; | |
| location @50*_json { |
| function random(): number { | |
| const buffer = new ArrayBuffer(8); | |
| const bytes = crypto.getRandomValues(new Uint8Array(buffer)); | |
| // sets the exponent value (11 bits) to 01111111111 (1023) | |
| // since the bias is 1023 (2 * (11 - 1) - 1), 1023 - 1023 = 0 | |
| // 2^0 * (1 + [52 bit number between 0-1]) = number between 1-2 | |
| bytes[0] = 63; | |
| bytes[1] = bytes[1] | 240; | |