代码片段
MIT License
.d3-3 {
display: flex;
flex-wrap: wrap;
margin-top: 20rpx;
.d3-3-i {
width: 155rpx;
height: 155rpx;
background-color: #00ff00;
border-radius: 5rpx;
margin-left: 75rpx;
margin-bottom: 20rpx;
&:nth-child(3n + 1) {
margin-left: 0;
}
}
}
.m2:last-of-type {
border-bottom: none;
}
acme.sh --install-cert -d foo.com \
--key-file /root/certs/root.key \
--fullchain-file /root/certs/root.pem \
--reloadcmd "systemctl reload nginx"
const date2string = (time_num) => {
const d = time_num - 1;
const t = Math.round((d - Math.floor(d)) * 24 * 60 * 60);
return moment(new Date(1900, 0, d, 0, 0, t)).format('YYYY-MM-DD');
}
{
"expiration": "2014-12-01T12:00:00.000Z",
"conditions": [
{"bucket": "johnsmith" },
["content-length-range", 1, 10],
["eq", "$success_action_status", "201"],
["starts-with", "$key", "user/eric/"],
["in", "$content-type", ["image/jpg", "image/png"]],
["not-in", "$cache-control", ["no-cache"]]
]
}
const { ShellEvaluator } = require('@mongosh/shell-evaluator')
let evaluator = new ShellEvaluator( )
console.log(evaluator);
let x = await evaluator.customEval(async function (a, b, c) {
console.log(a, b, c);
return
}, 'show dbs;')
const { CliServiceProvider } = require('@mongosh/service-provider-server');
const { WorkerRuntime } = require('@mongosh/node-runtime-worker-thread')
async function test() {
//const serviceProvider = await CliServiceProvider.connect('mongodb://localhost')
//console.log(serviceProvider);
// Create a new instance of the runtime and evaluate code from a playground.
//const runtime = new WorkerRuntime(serviceProvider);
const runtime = new WorkerRuntime('mongodb://localhost', {}, {})
await runtime.waitForRuntimeToBeReady()
// console.log(runtime)
runtime.setEvaluationListener({
onPrint(value) {
console.log('onPrint', value);
}
})
await runtime.evaluate('use abc');
let x = await runtime.evaluate(`show dbs;`)
console.log(x);
//let a = await runtime.evaluate(`db.tests.insertOne({fuck: 'you'})`)
//console.log(a)
await runtime.terminate()
}
test()
"dependencies": {
"@mongosh/browser-runtime-core": "^1.6.1",
"@mongosh/node-runtime-worker-thread": "^1.6.1",
"@mongosh/service-provider-server": "^1.6.1",
"@mongosh/shell-evaluator": "^1.6.1",
"@mongosh/types": "^1.6.1",
"koa": "^2.14.1",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"node-media-server": "^2.4.9",
"request": "^2.88.2",
"request-promise": "^4.2.6",
"saslprep": "^1.0.3"
}
.changelog-container {
.el-scrollbar {
height: calc(100vh - 100px);
}
/deep/ .el-scrollbar__bar.is-horizontal {
display: none !important;
}
}
.scrollbar-wrapper {
overflow-x: hidden !important;
}
<el-scrollbar wrap-class="scrollbar-wrapper">
<article
style="margin: 20px"
v-html="changelog"
class="markdown-body"
></article>
</el-scrollbar>
https://altearius.github.io/tools/json/index.html https://jsonhero.io/
var scene = document.querySelector('a-scene');
if (scene.hasLoaded) {
run();
} else {
scene.addEventListener('loaded', run);
}
function run () {
var entity = scene.querySelector('a-entity');
entity.setAttribute('material', 'color', 'red');
}
<a-scene loading-screen="enabled: false"></a-scene>
https://registry.npmmirror.com/binary.html?path=electron/
/etc/ssh/sshd_config
ClientAliveInterval 60
ClientAliveCountMax 10
systemctl restart sshd
cat /dev/null>/var/log/cron
upsert的时候,default参数不工作 注意注意注意
export const addOpacity = function (sharp: Sharp, opacity = 128): Sharp {
return sharp.composite([{
input: Buffer.from([255, 255, 255, opacity]),
raw: { width: 1, height: 1, channels: 4 },
tile: true,
blend: 'dest-in'
}]);
};
Remove-Item (Get-PSReadlineOption).HistorySavePath
npx uglifyjs --compress -m --output .\build\aframe.min.js .\build\aframe.js
npm init --scope=datong
npm publish --access public
https://github.com/selik/xport/issues/26
import pandas as pd
import xport
import xport.v56
df = pd.read_csv('input.csv')
ds = xport.Dataset(df, name='SPEC', sas_os='X64_DS12', sas_version='9.4')
with open('output.xpt', 'wb') as f:
xport.v56.dump(ds, f)
print("done")
import pandas as pd
import xport
import xport.v56
df1 = pd.read_csv('input.csv')
df2 = pd.read_csv('input.csv')
ds1 = xport.Dataset(df1, name='SPEC1', sas_os='X64_DS12', sas_version='9.4')
ds2 = xport.Dataset(df2, name='SPEC2', sas_os='X64_DS12', sas_version='9.4')
library = xport.Library({'SPEC1': ds1, 'SPEC2': ds2})
with open('output.xpt', 'wb') as f:
xport.v56.dump(library, f)
print("done")
const { stringify } = require('csv-stringify')
const { promisify } = require('util')
async function toCsv({ input, columns }) {
let csv = await promisify(stringify)(input, {
header: true,
columns,
})
return csv
}
toCsv({
input: [
['1', '2', '3', '4'],
['a', 'b', 'c', 'd']
],
columns: ['C1', 'C2', 'C3', 'C4'],
}).then((csv) => {
console.log(csv);
}).catch((err) => {
console.log(err);
})
db.adminCommand({ currentOp: true, $or: [{ op: "command", "command.createIndexes": { $exists: true }}, { op: "none", "msg": /^Index Build/ }]}).inprog[0].msg
async function test() {
let count = 0
let marker
while (true) {
let condition = {
prefix: 'images/',
'max-keys': 1000,
delimiter: '/',
}
if (marker) {
condition.marker = marker
}
let { objects, nextMarker } = await client.list(condition)
console.log(_.head(objects));
count += objects.length
marker = nextMarker
if (!marker) {
break
}
}
console.log(count);
}
const client = await page.target().createCDPSession();
console.log(await client.send("Network.getAllCookies"));
glob.sync(path + '**/*.{html,xhtml}')
glob.sync(path + '**/*.+(html|xhtml)')
glob.sync(path + '**/*.@(html|xhtml)')
PUPPETEER_DOWNLOAD_HOST=https://storage.googleapis.com.cnpmjs.org npm install puppeteer
npm install --ignore-scripts
location: {
type: {
type: String,
default: 'Point',
required: true
},
coordinates: {
type: [Number],
required: true,
index: '2dsphere'
}
}
XS:extra small 加小码
S:small 小码
M:medium 中码
L:large 大码
XL:extra large 超大码
web boundary
xs = extra small < 768
sm = small >= 768
md = middle >= 992
lg = large >= 1200
xl = extra large >= 1920
white-space: pre-line;
CAS
libraryVariants.all {
it.generateBuildConfig.enabled = false
}
环形队列是解决固定长度缓冲区的通用方法
package butterknife.internal;
import android.view.View;
/**
* A {@linkplain View.OnClickListener click listener} that debounces multiple clicks posted in the
* same frame. A click on one button disables all buttons for that frame.
*/
public abstract class DebouncingOnClickListener implements View.OnClickListener {
static boolean enabled = true;
private static final Runnable ENABLE_AGAIN = new Runnable() {
@Override public void run() {
enabled = true;
}
};
@Override public final void onClick(View v) {
if (enabled) {
enabled = false;
v.post(ENABLE_AGAIN);
doClick(v);
}
}
public abstract void doClick(View v);
}
git rm --cached -r dir/
'DejaVu Sans Mono',Consolas,'Courier New', monospace, 微软雅黑
{
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
}
server {
listen 80;
server_name [domain];
location / {
proxy_pass http://localhost:[port];
proxy_http_version 1.1;
proxy_set_header Host $host; # 真实的客户端域名
proxy_set_header X-Real-IP $remote_addr; #真实的客户端IP地址
proxy_set_header Upgrade $http_upgrade; # websocket
proxy_set_header Connection "upgrade"; # websocket
}
}
server {
listen 80;
server_name [domain];
root [dir]/dist;
index index.html;
location /favicon.ico {
root [dir]/dist;
}
location / {
try_files $uri /index.html;
}
location = /index.html {
expires -1;
}
}
[MongoDB]
name=MongoDB Repository
baseurl=http://mirrors.aliyun.com/mongodb/yum/redhat/7/mongodb-org/3.2/x86_64
gpgcheck=0
enabled=1
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
net:
port: 27017
# bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
security:
authorization: enabled
server {
listen 80;
server_name ithot.org;
return 301 https://$server_name$request_uri;
}
server {
listen 443;
server_name ithot.org;
ssl on;
ssl_certificate /etc/nginx/cert/214450036080552.pem;
ssl_certificate_key /etc/nginx/cert/214450036080552.key;
ssl_session_timeout 5m;
location / {
proxy_pass http://localhost:7000;
}
}
type | record | value |
---|---|---|
A | @ | 220.181.112.244 |
dominant url | www | https://ithot.org |
config = require 'config'
Promise = require 'bluebird'
AliSms = require 'ali-sms-callback'
client = new AliSms
AccessKeyId: '-',
AccessKeySecret: '-'
module.exports =
TEMPLATE:
REGISTER: 'SMS_126865294'
FINDBACK: 'SMS_121905212'
sendTemplateSMS: (template, phone, vars) ->
new Promise (resolve, reject) ->
options =
SignName: 'EnglishICO'
TemplateCode: template
TemplateParam: JSON.stringify vars
PhoneNumbers: phone
client.SendSms options, (err, data) ->
if err?
reject err
else
resolve data
app.js onLaunch()
const manager = wx.getUpdateManager();
manager.onCheckForUpdate(res => {
logger.debug(res);
});
manager.onUpdateReady(() => {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success(res) {
if (res.confirm) {
manager.applyUpdate();
}
}
});
});
manager.onUpdateFailed(err => {
logger.debug(err);
});