class Solution {
public int findPairs(int[] nums, int k) {
if (k < 0) {
return 0;
}
Map<Integer, Integer> numCounts = new HashMap<>();
for (int num : nums) {
numCounts.put(num, numCounts.getOrDefault(num, 0) + 1);
}
int pairCount = 0;
for (int num : numCounts.keySet()) {
if (k == 0) {
if (numCounts.get(num) > 1) {
pairCount++;
}
# VPS常用命令
- ## 重启NaiveProxy(caddy服务器)
```bash
systemctl reload caddy
```
- ## 查找大于20MB的文件
```bash
find . -type f -size +20M -print0 | xargs -0 du -h
```
Scraper Types
Type Description
Fragment Uses existing metadata for an Item and match it to a result from a metadata source.
Search/By Name Uses a provided query string to search a metadata source for a list of matches for the user to pick from.
URL Extracts metadata from a given URL.
Supported Scrapers
Fragment Search URL
gallery ✔️ ✔️
image ✔️ ✔️
group ✔️
performer ✔️ ✔️
scene ✔️ ✔️ ✔️
- id: <package id>
name: <package name>
version: <version>
date: <date>
requires:
- <ids of packages required by this package (optional)>
- ...
path: <path to package zip file>
sha256: <sha256 of zip>
metadata:
<optional key/value pairs for extra information>
- ...
# How to configure NTP client/server in Ubuntu 20
Source: https://toxigon.com/ubuntu-20-04-ntp-server
## Install NTP application
Install ntp application use apt:
```
$ sudo apt install ntp
```
This will install the NTP daemon (ntpd) and all its dependencies.
You can check the status of the service with:
```
$ sudo systemctl status ntp
```
You should see output similar to this:
```
● ntp.service - Network Time Service Loaded: loaded (/lib/systemd/system/ntp.service;
import java.io.FileReader;
import java.io.IOException;
import java.util.Locale;
import java.util.Scanner;
public class ReadSalesData {
private String arrID[] = new String[100];
private String arrTitle[] = new String[100];
private String arrAuthor[] = new String[100];
private double arrPrice[] = new double[100];
private int size;
public void readData(String filename){
try{
FileReader fr = new FileReader(filename);
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;
public class TextfileData {
private String arrMonth[] = new String[50];
private int arrYear[] = new int[50];
private int arrRainfall[] = new int[50];
private int n;
public void ReadData(String filename){
try{
FileReader fr = new FileReader(filename);
Scanner inFile = new Scanner(fr);
n = 0;
while(inFi
#include <iostream>
using namespace std;
int main(){
return 0;
}
# 作成手順
エディタはCursor、パッケージ管理はuvを使う想定で進める。
## 1. プロジェクトの初期化
以下のコマンドを実行する。
```
$ uvx create-mcp-server --path . --name mcp-server --description mcp-server --version 0.1.0 --no-claudeapp
```
## 2. 依存関係のインストール
以下のコマンドを実行する。
```
$ uv sync --dev --all-extras
```
## 4. MCPサーバーの設定を追加
プロジェクトディレクトリの `.cursor/mcp.json` に以下のように記述する
```
{
"mcpServers": {
"mcp-server": {
"command": "uv",
"args": [
"--directory",
"C:\\Users\\[ユーザー]\
# 作成手順
エディタはCursor、パッケージ管理はbunを使う想定で進める。
## 1. プロジェクトの初期化
以下のコマンドを実行する。
```
$ bun init -y
```
## 2. 必要なツールのインストール
以下のコマンドを実行する。
```
$ bun add @modelcontextprotocol/sdk
```
## 3. MCPサーバーの処理を作成
`index.ts` に以下のコードを記述する。
```
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { z } from "zod";
const config = {
server: {
name: "simple-mcp-se
# Windows
## Claude Desktop
### 1. MCPサーバーの設定を追加
`C:\Users\[ユーザー]\AppData\Roaming\Claude\claude_desktop_config.json` に以下のように記述する
```
{
"mcpServers": {
"sequential-thinking": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sequential-thinking"
]
}
}
}
```
### 2. Claude Desktop を再起動する
Claude Desktop を再起動する。
ウィンドウを閉じただけでは裏で常駐アプリが動いているので終了されないため注意する。
### 3. 起動状態を確認する
メニュー>File>Settings...>Develop
// App.tsx old
const root = createRoot(document.getElementById("root"));
root.render(
<ThemeContext.Provider>
<UserContext.Provider>
<QueryClientProvider client={queryClient}>
<Provider store={store}>
<IntlProvider locale={usersLocale}>
<App />
</IntlProvider>
</Provider>
</QueryClientProvider>
</UserContext.Provider>
</ThemeContext.Provider>
)
// App.tsx new
const buildProvidersTree = (componentsWithProps) => {
kubectl get secrets --all-namespaces -o yaml | grep -i "docker"
- greps all of secrets for "docker"
kubectl get pods --all-namespaces -o jsonpath="{..image}" | tr ' ' '\n' | grep "docker"
- greps all pods for something "docker"
# Define registry path and properties for GlobalProtect
$registryPath = "HKLM:\Software\Palo Alto Networks\GlobalProtect\PanSetup"
$propertyName = "Portal"
$propertyValue = "wsp-ida-fw.wspartners.com"
# GitHub Authentication
$personalAccessToken = "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" # Replace with your GitHub PAT
$githubApiUrlGP = "https://api.github.com/repos/WesternSmokehousePartners/WSP/contents/GlobalProtect64.msi" # Repla
PowerShell.exe -ExecutionPolicy Bypass
Install-Script -Name Get-WindowsAutopilotInfo -Force
Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned
Get-WindowsAutopilotInfo -Online