Skip to content

Instantly share code, notes, and snippets.

View tomodachi94's full-sized avatar

Tomo tomodachi94

View GitHub Profile
@iamgreaser
iamgreaser / gist:2299961
Created April 4, 2012 09:32
decent ComputerCraft floppy virus
local xpayload = [[
-- evalquine resident ComputerCraft virus
-- by GreaseMonkey, 2012-04-04
local payload, xshell
payload, xshell = ...
local function wreck_everything()
local function split(s,token)
local l = {}
@Cyrixus
Cyrixus / wget
Created April 15, 2012 02:46
A ComputerCraft version of wget (based on HttpTest)
--[[
wget
A program adapted from HttpTest, by Epsen:
http://www.computercraft.info/forums2/index.php?/topic/82-121-httptest-v13/page__hl__http__fromsearch__1
Credit for the original work goes to him. Additional modifications have been
made to the file to make it suitable for my own purposes.
@dsquier
dsquier / strip_ext.awk
Created April 11, 2014 21:10
AWK function to strip a file extension
## Strip the trailing extension from a file
strip_ext() {
FILENAME=$1
EXTENSION=`echo $FILENAME | gawk -F. '{ print "."$NF }'`
echo $FILENAME | awk -F$EXTENSION '{ print $1 }'
}
@JacobJohansen
JacobJohansen / AuthyToOtherAuthenticator.md
Created October 20, 2017 15:12 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes (beware, through Google) for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My gues

@MCJack123
MCJack123 / client.lua
Last active July 20, 2022 22:27
Door lock program for ComputerCraft using secure remote servers, supporting optional key expiration & use limits
-- Save this as startup.lua on each client computer with a drive and modem attached. You can also optionally attach a speaker for audio feedback.
local secret = "" -- Set this to the same secret that was set in the server file.
local redstoneSide = "left" -- Set this to the side the redstone signal should be output on.
local openTime = 5 -- Set this to the number of seconds to keep the door open for.
local defaultOutput = false -- Set this to the default redstone state for the door. If set to true, this means power will be cut when unlocking.
-- This allows you to place a door sideways, and then have it stay closed even when power is applied externally.
if not secret or secret == "" then error("Please set some keys inside the script before running.") end
local ok, err = pcall(function()
@MCJack123
MCJack123 / redrun.lua
Last active March 14, 2023 20:34
RedRun - A very tiny background task runner for CC using the native top-level coroutine
--- RedRun - A very tiny background task runner using the native top-level coroutine
-- By JackMacWindows
-- Licensed under CC0, though I'd appreciate it if this notice was left in place.
-- @module redrun
-- Note: RedRun is not intended for use as a fully-featured multitasking environment. It is meant
-- to allow running small asynchronous tasks that just listen for events and respond (like
-- rednet.run does). While it is certainly possible to use this to make a functioning kernel, you
-- should not do this as a) any time spent in the processes is time taken from Rednet, and b) there
-- is no filtering for user-initiated events, or automatic terminal redirect handling.
@fern9001
fern9001 / nixos-vim-guide.md
Last active February 9, 2024 18:13
Fern's NixOS Vim Guide

Fern's NixOS Vim Guide

A newbie friendly guide to configuring Vim in NixOS

File Structure

Create the following file struture in /etc/nixos

/etc/nixos
    |-- apps
        |-- vim
            |-- default.nix 
            |-- vimPlugins.nix
@MCJack123
MCJack123 / on-writing-an-os.md
Last active May 28, 2024 16:07
On Writing a ComputerCraft OS

On Writing a ComputerCraft OS

One of the most common projects I've seen for ComputerCraft is to write an operating system. People look at the limited command-line interface that CraftOS provides, and think, "I want this to work like my normal computer does!" Time and time again, a new post pops up on the ComputerCraft forums or Discord either announcing an OS, or asking for help with an OS, or releasing an OS. Usually, there are some very obvious flaws in these "OS"es, ranging from poor design choices, to overstating what they are and underdelivering. There are many common misunderstandings and undersights that newbie developers run into when writing an operating system, and these end up creating mediocre products at best.

A Critical Distinction

The term "OS" is thrown around a lot, and in my opinion it's very overused. According to [Wikipedia]: "An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs." However, m

@MCJack123
MCJack123 / sane-api.md
Created June 6, 2022 04:13
On Writing a Sane API

On Writing a Sane API

Over my years on the ComputerCraft Discord server, I've had the opportunity to witness the creation of numerous APIs/libraries of all sorts. I've gotten to examine these APIs in depth, as well as answer questions involving the APIs that the creators or users have. As an API designer myself, I compare the designs of other APIs with my designs, and I've noticed a number of patterns that make or break an API design. I've seen plenty of designs that make me go "WTF???", and lots that I just can't understand, even at my advanced level of programming (not to toot my own horn).

This article outlines some rules for making a sane API, which is easy to use, understandable, and doesn't make the user spin in circles to make things with it. Note that when I use the term "API", I'm primarily referring to code libraries and their public interfaces, but a number of points can be applied to web APIs as well. Since I have the most experience in Lua APIs, I'll be focu

@MasonGulu
MasonGulu / billboard.lua
Last active May 17, 2023 04:31
Simple program for displaying BIMG files on a term capable peripheral
local function resetPalette(periph)
local mon
if periph == "term" then
mon = term
else
mon = assert(peripheral.wrap(periph), periph.." is not a valid peripheral")
end
for i = 0, 15 do
mon.setPaletteColor(2^i, term.nativePaletteColor(2^i))