Skip to content

Instantly share code, notes, and snippets.

View cyberbit's full-sized avatar
🌙

cyberbit

🌙
View GitHub Profile
@cyberbit
cyberbit / GraphOutputAdapter.lua
Created May 8, 2024 13:33
telem.output.basalt.graph patch for dynamicValues issue
local o = require 'telem.lib.ObjectModel'
local t = require 'telem.lib.util'
local OutputAdapter = require 'telem.lib.OutputAdapter'
local MetricCollection = require 'telem.lib.MetricCollection'
local GraphOutputAdapter = o.class(OutputAdapter)
GraphOutputAdapter.type = 'GraphOutputAdapter'
GraphOutputAdapter.MAX_ENTRIES = 50
----------------------------------------------------
-- MIGRATED TO https://github.com/cyberbit/fluent --
----------------------------------------------------
-- Fluent by cyberbit
-- MIT License
-- Version 0.2.0
---@class cyberbit.Fluent
@cyberbit
cyberbit / ccmaps_install.lua
Last active March 17, 2024 06:07
CCMaps Installer
-- CCMaps Installer by cyberbit
-- MIT License
-- Version 2024-03-17
local paths = {
['ccmaps.lua'] = 'https://gist.githubusercontent.com/cyberbit/b64e2e04b1006778b9077553768e07f4/raw/ccmaps.lua',
['plotter.lua'] = 'https://github.com/cyberbit/plotter/releases/download/v0.0.4/plotter.lua'
}
for path, url in pairs(paths) do
-- CCMaps by cyberbit
-- MIT License
-- Version 0.0.2
local plotterFactory = require 'plotter'
-- local polyFactory = require 'luapoly'
-- local pprint = require 'cc.pretty'.pretty_print
-- shell.run('attach right monitor')
@cyberbit
cyberbit / mandelplot.lua
Created March 10, 2024 04:27
Mandelplot
local Plotter = (function ()
-- Plotter by cyberbit
-- MIT License
-- Version 0.0.2
local pixelbox2 = (function ()
-- Pixelbox Lite v2 by 9551-Dev
-- (v1: https://github.com/9551-Dev/apis/blob/main/pixelbox_lite.lua)
local pixelbox = {}
local e={}local t,a,o=require,{},{startup=e}
local function i(n)local s=o[n]
if s~=nil then if s==e then
error("loop or previous error loading module '"..n..
"'",2)end;return s end;o[n]=e;local h=a[n]if h then s=h(n)elseif t then s=t(n)else
error("cannot load '"..n.."'",2)end;if s==nil then s=true end;o[n]=s;return s end
a["ecnet.util"]=function(...)
local n={__tostring=function(r)return string.char(unpack(r))end,__index={toHex=function(r)return("%02x"):rep(
#r):format(unpack(r))end,isEqual=function(r,d)if
type(d)~="table"then return false end;if#r~=#d then return false end;local l=0
#!/usr/bin/env bash
#
# Launch a bash session in your docker workspace, from a specified starting directory.
#
# Usage: larabash [workdir]
# workdir: path to starting root directory (defaults to name of current directory)
######################################################################################
# Parent directory of project on host machine
# for example, project is at /path/to/project/parent/project
@cyberbit
cyberbit / example.php
Created April 29, 2020 21:32
Foreach referential variable
<?php
$original = [
[
'id' => 1,
'name' => 'foo'
],
[
'id' => 2,
'name' => 'bar'
part1 () {
let rows = _.split(this.input, '\n')
let grid = _.times(MAX_DIM * MAX_DIM, _.constant(0))
_.each(rows, v => {
let [x, y, w, h] = _
.chain(v.match(/#\d+ @ (\d+),(\d+): (\d+)x(\d+)/)) // separate parts
.tail() // discard full match
.map(Number) // cast to numbers
.value() // destructure to variables