Skip to content

Instantly share code, notes, and snippets.

View szdytom's full-sized avatar

方而静 szdytom

  • Guangzhou, China
  • 23:23 (UTC +08:00)
View GitHub Profile
@szdytom
szdytom / backup_to_cloud.sh
Created October 25, 2023 04:04
Backup Minecraft Server
#!/bin/bash
# 获取当前时间戳
timestamp=$(date +%Y%m%d%H%M%S)
# 设置文件夹路径
folder_path="slot1"
# 设置备份文件名
backup_file="backup-${timestamp}.tar.xz"
@szdytom
szdytom / notelab.sc
Last active October 16, 2023 08:28
[Minecraft] Play music score inside books!
__config() -> {
'scope' -> 'global',
};
global_playList = {};
global_playListCounter = 1;
readBook(itemTuple) -> (
itemNbt = itemTuple:2;
content = '';
@szdytom
szdytom / 6cc.cpp
Created July 31, 2023 12:22
6cc - Markdown Foldblock Extension
#include <bits/stdc++.h>
using namespace std;
int now;
string s;
vector<int> sta;
bool match(string t) {
@szdytom
szdytom / shoot-fireball.sc
Created July 8, 2023 10:24
[Minecraft] Shoot fireballs!
__on_player_uses_item(player, item_tuple, hand)->(
if(item_tuple:0 == 'fire_charge',
playerPos = query(player, 'pos') + l(0, 1, 0); // Set the position where the fireball will spawn
sound('entity.blaze.shoot', playerPos); // Play a sound
playerPitch = query(player, 'pitch'); // Detect where the player is looking
playerYaw = query(player, 'yaw') + 90;
v = query(player, 'look');
fbv = v * 0.25;
@szdytom
szdytom / cloudstorage.sc
Last active July 29, 2023 02:14
[Minecraft] Store items in the "cloud"!
__config -> {};
__on_start() -> (
if(nbt_storage('cloud_storage:item_data'):'Barrels' == null, (
nbt_storage('cloud_storage:item_data', '{Barrels: []}');
))
);
upload_items(myself, bpos, name) -> (
barrel = block(bpos);
@szdytom
szdytom / shulkerbox-inhand.sc
Last active October 25, 2023 06:33
A Minecraft scarpet script that allow to operator shulker boxes without placing it.
__config() -> {
'scope' -> 'global',
};
global_shulker_boxes = {
'shulker_box',
'white_shulker_box',
'orange_shulker_box',
'magenta_shulker_box',
'light_blue_shulker_box',
@szdytom
szdytom / compasstp.sc
Created July 7, 2023 08:26
a Minecraft scarpet script that allows players to teleport with compass.
__config() -> {
'commands' -> {
'' -> 'tp_compass',
'set' -> 'set_compass',
'get' -> 'get_compass_info'
}
};
set_compass() -> (
myself = player();
@szdytom
szdytom / download_music.py
Created September 24, 2020 10:35
下载酷狗音乐歌曲
import re
import json
import time
import requests
from fake_useragent import UserAgent
ua = UserAgent()
def get_song(song_name):
@szdytom
szdytom / retry_until_ok.py
Created September 18, 2020 12:38
retry until ok
#! /bin/python3
import os
import sys
import time
os.system("touch /tmp/retry_sys_last_cmd_tmp_store")
last_cmd_file = open("/tmp/retry_sys_last_cmd_tmp_store", "r")
last_cmd = str(last_cmd_file.read())