This is an example, expect no assistance with operation.
This file should go into /lib/systemd/system
- You will need to replace
init.lua
with the name of your bot's entrypoint file (maybemain.lua
orbot.lua
).
local pack, unpack, char, byte = string.pack, string.unpack, string.char, string.byte | |
local random = math.random | |
local leftover_fmt = {'>I1', '>I2', '>I3'} | |
local function mask_message(data, mask) | |
local res = {} |
local ffi = require 'ffi' | |
local function permute_inner(arr, l, r) | |
if l == r then | |
coroutine.yield(ffi.string(arr)) | |
else | |
for i = l, r do | |
arr[l], arr[i] = arr[i], arr[l] | |
permute_inner(arr, l + 1, r) | |
arr[l], arr[i] = arr[i], arr[l] |
local uv = require 'uv' | |
local buffer = "" | |
local waiting = {} | |
process.stdin:on("data", function(data) | |
if not data then return end | |
buffer = buffer .. data |
local ffi = require 'ffi' | |
local fs = require 'fs' | |
local Process = {} | |
Process.__index = Process | |
if ffi.abi('win') then | |
local psapi = ffi.load('psapi') | |
ffi.cdef [[ |
local ffi = require 'ffi' | |
local Mutex = {} | |
Mutex.__index = Mutex | |
if ffi.abi('win') then | |
-- trust me on these, we treat CRITICAL_SECTION like an opaque pointer. | |
local sizeof_critical_section = ffi.abi('32bit') and 24 or 40; | |
local libc = ffi.load('msvcrt') |
#!/bin/bash | |
base="$PWD" | |
file="$PWD/version.md" | |
git clone https://github.com/luvit/lit | |
git clone https://github.com/luvit/luvi | |
echo "" >$file |
local fs = require 'fs' | |
local json = require 'json' | |
local Database = {} | |
Database.__index = Database | |
function Database.load(path) | |
local self = setmetatable({}, Database) | |
self.path = path |
#!/usr/bin/env bash | |
RUN_SESSION_NAME="discord" | |
RUN_COMMAND="./luvit bot" | |
RUN_ERRLOG="./stderr.log" | |
if [ -z $TMUX ]; then | |
if ! command -v tmux >/dev/null; then | |
echo "fatal: tmux not installed" | |
exit 1 |
$ zig build d01 -Drelease-fast | |
Benchmark File: | |
Time: 0s 0ms 261us 0ns | |
Memory: 0MB 4KB 96B | |
Benchmark Input: | |
Time: 0s 0ms 1us 600ns | |
Memory: 0MB 0KB 0B | |
Benchmark Part 1 & 2: |