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
import rushLib from "@microsoft/rush-lib"; | |
import { StringBufferTerminalProvider } from "@rushstack/node-core-library"; | |
import { Terminal } from "@rushstack/node-core-library"; | |
export function getRushConfiguration() { | |
const config = rushLib.RushConfiguration.loadFromDefaultLocation(); | |
return config; | |
} | |
/** |
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
#!/usr/bin/env zx | |
import "zx/globals"; | |
const pkgsStr = await $`npx lerna list --json --loglevel silent`.quiet(); | |
const pkgs = JSON.parse(pkgsStr); | |
const transformed = pkgs.map((p) => { | |
return { | |
packageName: p.name, |
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
#!/usr/bin/env zx | |
const gitignoreFile = argv._[0]; | |
const content = await fs.readFile(gitignoreFile, { encoding: "utf-8" }); | |
const rulesSet = new Set(); | |
const lines = content.split(`\n`); | |
const newLines = lines.filter((l) => { |
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 http = require("http"); | |
const { promisify } = require("util"); | |
const sleep = promisify(setTimeout); | |
const server = http.createServer((req, res) => {}); | |
server.listen(6000, async () => { | |
console.log("listening..."); | |
await sleep(2000); |
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 glob = require("glob"); | |
const fs = require("fs-extra"); | |
async function main() { | |
const pkgFilePaths = glob.sync("./packages/*/package.json"); | |
console.log(pkgFilePaths); | |
const prefixes = new Set(); |
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
class CustomError extends Error { | |
constructor(foo = "bar", ...params) { | |
// Pass remaining arguments (including vendor specific ones) to parent constructor | |
super(...params); | |
// Maintains proper stack trace for where our error was thrown (only available on V8) | |
// if (Error.captureStackTrace) { | |
// Error.captureStackTrace(this, CustomError); | |
// } |
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
# 本文件复制自部署机器上 openvpn 生成的 systemd service 文件,目录为 | |
# /lib/systemd/system/[email protected] | |
# | |
# 其源代码也可以在 https://packages.ubuntu.com/en/xenial-updates/openvpn 中下载 | |
# 源包获得 | |
[Unit] | |
Description=OpenVPN connection to %i | |
PartOf=openvpn.service | |
ReloadPropagatedFrom=openvpn.service | |
Before=systemd-user-sessions.service |
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
ObjC.import("stdlib"); | |
function run(argv) { | |
const app = Application.currentApplication() | |
app.includeStandardAdditions = true | |
app.doShellScript(`open https://www.baidu.com`) | |
var query = argv[0]; | |
return query; |
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
package main | |
import ( | |
"context" // Use "golang.org/x/net/context" for Golang version <= 1.6 | |
"flag" | |
"net/http" | |
"github.com/golang/glog" | |
"github.com/grpc-ecosystem/grpc-gateway/runtime" | |
"google.golang.org/grpc" |
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
#!/usr/bin/env bash | |
package=$1 | |
if [[ -z "$package" ]]; then | |
echo "usage: $0 <package-name>" | |
exit 1 | |
fi | |
package_split=(${package//\// }) | |
package_name=${package_split[-1]} |
NewerOlder