Skip to content

Instantly share code, notes, and snippets.

View codehz's full-sized avatar
🔮

Neko Hz codehz

🔮
View GitHub Profile
@codehz
codehz / getbds.sh
Created August 18, 2020 03:22
bds scripts
#!/bin/bash
set -euxo pipefail
dwpage='https://www.minecraft.net/en-us/download/server/bedrock/'
dwregx='https://minecraft.azureedge.net/bin-win/bedrock-server-.*?.zip'
url=$(curl "$dwpage" | grep -oP "$dwregx")
curl -o bds.zip -L "$url"
@codehz
codehz / iprule.sh
Last active March 4, 2024 09:39
nftables for redir proxy
ip rule add fwmark 0x233 lookup 100
ip route add local 0.0.0.0/0 dev lo table 100
@codehz
codehz / 9pvm.sh
Created May 8, 2020 01:40
Run qemu with 9p rootfs
#!/bin/bash
set -euxo pipefail
kernel="${kernel:-kernel}"
initrd="${initrd:-initramfs.cpio.gz}"
target="$1"
shift
nsroot -xpf -- qemu-system-x86_64 \
-enable-kvm \
-m 1G \
-smp 2 \
#include <chrono>
#include <iostream>
#include <random>
#include <sqlite3.h>
int loadOrSaveDb(sqlite3 *pInMemory, const char *zFilename, bool isSave) {
int rc; /* Function return code */
sqlite3 *pFile; /* Database connection opened on zFilename */
sqlite3_backup *pBackup; /* Backup object used to copy data */
function(init_user_prop prop)
if(${prop})
set(ENV{_${prop}} "${${prop}}")
else()
set(${prop} "$ENV{_${prop}}" PARENT_SCOPE)
endif()
endfunction()
function(generate_winsdk_vfs_overlay winsdk_include_dir output_path)
set(include_dirs)
@codehz
codehz / evilgcc.h
Last active December 22, 2019 02:27
#pragma once
#ifndef __GNUC__
# error This header only works in GCC
#endif
#ifdef __clang__
# ifndef __ccls__
# warning This header may not working in clang
# endif
declare module 'picogl' {
enum GL {
DEPTH_BUFFER_BIT = 0x00000100,
STENCIL_BUFFER_BIT = 0x00000400,
COLOR_BUFFER_BIT = 0x00004000,
POINTS = 0x0000,
LINES = 0x0001,
LINE_LOOP = 0x0002,
LINE_STRIP = 0x0003,
TRIANGLES = 0x0004,
#!/bin/bash
rm -rf contents.json
temp=$(mktemp)
trap "rm -rf $temp" EXIT
find -type f | sed 's/^.\//path=/' | parallel jo | jo -a | sed 's/^/content=/' > $temp
echo "version=1" >> $temp
cat $temp | jo -p >> contents.json
#!/bin/bash
set -euo pipefail
url_cobblestone="https://hertz.services/docker/codehz/cobblestone/0"
url_bds="https://hertz.services/docker/codehz/bds/0"
url_nsgod="https://hertz.services/github/codehz/nsgod/latest/nsgod"
mkdir -p .cobblestone/{core,game}
tempdir=$(mktemp -d)
echo "[+] created temp directory: ${tempdir}"
#!/usr/bin/env node
const constants = require("./constants.js");
const api = require("stoneapi-js");
const Discord = require('discord.js');
const client = new Discord.Client();
api.init();
api.attach();
const channels = constants.channels;