Skip to content

Instantly share code, notes, and snippets.

@i-sync
i-sync / README.md
Created April 30, 2024 13:57
Hook Sitecore API, Update NameValue key field set field width to 500px

Hook Sitecore API, Update NameValue key field set field width to 500px

Before Update

After Update

@i-sync
i-sync / nginx.conf
Created December 13, 2023 13:22
nginx log format
log_format custom_format '$remote_addr - $remote_user [$time_local] "$host $request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'$request_time';
access_log /var/log/nginx/access.log custom_format;
@i-sync
i-sync / README.md
Last active October 13, 2023 09:54
docker-compose add proxy

How to add proxy to docker-compose.yml & Dockerfile

The proxy in my host machine.

example: https://10.0.0.1:8123

Update the docker-compose.yml

Add the extra_hosts

@i-sync
i-sync / audio-split.py
Last active October 25, 2023 07:01
Audio Split 音频文件分割
import os
import subprocess
base_directory = "/path/to/source" # 输入目录的基本路径
output_directory = "/path/to/dest" # 切割后的音频文件保存的目录
segment_duration = 180 # 切割的每个片段的时长(以秒为单位)
def get_audio_encoding(input_path):
command = f'ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "{input_path}"'
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
@i-sync
i-sync / puppeteer.js
Last active May 14, 2024 13:21
Python use selenium skip cloudflare Verify you are human
//this works.
const puppeteer = require('puppeteer');
const fs = require('fs')
const path = require('path')
const { promisify } = require('util')
const readFileAsync = promisify(fs.readFile)
const writeFileAsync = promisify(fs.writeFile);
@i-sync
i-sync / nginx.conf
Created March 16, 2023 10:31
nginx log format show full request url
####
# URL: https://stackoverflow.com/a/37877244
####
log_format main '$http_x_forwarded_for - $remote_user [$time_local] '
'"$request_method $scheme://$host$request_uri $server_protocol" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $request_time';
@i-sync
i-sync / parser.py
Created June 24, 2022 04:14
v2ray connection parser
#!/usr/bin/python3
from audioop import add
import os, json
def main():
outbounds = []
inbounds = []
inbound_template = """
{{
@i-sync
i-sync / backup.sh
Last active October 8, 2023 06:42
Mysql auto backup script
#!/bin/bash
# Database credentials
user="root"
password="xxx"
host=""
db_name="database_name"
# Other options
backup_path="/root/backup/mysql"
@i-sync
i-sync / ImportWizardFromCSV.ps1
Created February 19, 2022 13:14 — forked from michaellwest/ImportWizardFromCSV.ps1
Import content from a CSV using Sitecore PowerShell Extensions.
<#
.SYNOPSIS
Data Import Wizard provides a way to generate or update content from an external file.
.DESCRIPTION
The import file uses the properties "Name" and "Id" to help match existing items.
.NOTES
Requires Sitecore PowerShell Extensions 4.6 or newer.