This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Defines element markup --> | |
<template> | |
<p>Hello <strong></strong> :)</p> | |
</template> | |
<script> | |
(function(window, document, undefined) { | |
// Refers to the "importer", which is index.html | |
var thatDoc = document; | |
// Refers to the "importee", which is src/hello-world.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------ | |
// npm install rollup rollup-plugin-flow-no-whitespace rollup-plugin-buble rollup-plugin-alias he de-indent | |
// ------------------------- | |
// Edit rollup-plugin-alias.js | |
// if (!/js$/.test(updatedId)) { | |
// console.log(updatedId + ' ----> ' + updatedId + '.js'); | |
// updatedId += '.js'; | |
// } | |
// ------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Aliyun OpenVPN: https://help.aliyun.com/knowledge_detail/42521.html | |
# sudo bash update_source.sh // usa can't visit mirrors.aliyun.com | |
yum install -y lzo lzo-devel openssl openssl-devel pam pam-devel pkcs11-helper pkcs11-helper-devel | |
rpm -qa lzo lzo-devel openssl openssl-devel pam pam-devel pkcs11-helper pkcs11-helper-devel | |
wget http://oss.aliyuncs.com/aliyunecs/openvpn-2.2.2.tar.gz | |
yum install -y rpm-build gcc gcc-c++ | |
rpmbuild -tb openvpn-2.2.2.tar.gz | |
# rpm -ivh openvpn-2.2.2-1.x86_64.rpm | |
rpm -ivh ./rpmbuild/RPMS/x86_64/openvpn-2.2.2-1.x86_64.rpm | |
cd /usr/share/doc/openvpn-2.2.2/easy-rsa/2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# : | |
@echo off | |
copy/b "%~f0" "%temp%\%~n0.ps1" >nul | |
powershell -Version 2 -ExecutionPolicy bypass -noprofile "%temp%\%~n0.ps1" "%cd% " "%~1" | |
del "%temp%\%~n0.ps1" | |
pause | |
exit /b | |
#> | |
param([string]$cwd='.', [string]$dll) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node findmac.js 10.10.2.255 c4-01-7c-3d-b8-40 | |
const exec = require('child_process').exec; | |
// http://thebackroomtech.com/2010/08/22/determine-ip-address-from-a-mac-address/ | |
var broadcast = process.argv[2] | |
, mac = process.argv[3] | |
, targetIP = ''; | |
if (!broadcast) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { BufferedProcess, Point } = require('atom'); | |
const fs = require('fs') | |
const DEBUG_ESLINT = false; | |
// execute shell command | |
const executeCommand = function executeCommand (command, callback) { | |
command = command.split(' '); | |
const args = command.slice(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const s1 = '\\[ \\{ \\} \\] , / \\? : @ & = \\+ \\$ # " \\\\'.split(' '); // '[{}],/\?:@&=\+$#"\ ' | |
const s2 = '%5B%7B%7D%5D%2C%2F%3F%3A%40%26%3D%2B%24%23%22%5C%20'.match(/.{3}/g); // encodeURIComponent('[{,/\?:@&=\+$#"\\ ') | |
const s3 = '[{}],/\?:@&=\+$#"\\ '.split(''); | |
s1.push(' '); | |
module.exports.encodeURIComponent = function encodeURIComponent(str) { | |
let res = `${str}`; | |
for (let i = 0; i < s1.length; i += 1) { | |
res = res.replace(new RegExp(s1[i], 'g'), s2[i]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {executeCommand, getCurrentEditorProjectHome, isFileExist} = require('./atom-utils.js'); | |
const fs = require('fs') | |
const portMap = {} | |
const autorunIfNeeded = function autorunIfNeeded(editor = atom.workspace.getActiveTextEditor()) { | |
const project = getCurrentEditorProjectHome(editor); | |
if (isFileExist(`${project}/Dockerfile`)) { | |
const content = fs.readFileSync(`${project}/Dockerfile`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
module.exports = function(atom, windows) { | |
console.log('close big file') | |
atom.workspace.onDidOpen(editor => { | |
try { | |
const file = editor.uri; | |
const stats = fs.statSync(file); | |
if (stats.size > 2e4) { // Bigger than 20KB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const exec = require('child_process').exec; | |
const ping = (ip) => { | |
return new Promise((resolve, reject) => { | |
exec(`ping ${ip}`, (err, stdout, stderr) => { | |
if (err) { | |
reject(err); | |
return; | |
} | |
resolve({ip, stdout}); |
OlderNewer