Skip to content

Instantly share code, notes, and snippets.

#==============================================================================
# Pixel Offset
# by IMP1
#------------------------------------------------------------------------------
# This script allows events' locations on screen to be offset.
#
# Usage:
# In an event, create a new comment.
# Add either of the following:
# MOVE 0, 0
#==============================================================================
# Storage Boxes Addon: Readonly Boxes
# by IMP1
#------------------------------------------------------------------------------
# THIS SCRIPT REQUIRES THE 'STORAGE BOXES' SCRIPT BY IMP1, AT LEAST v1.11
#
# Now boxes can be set to only have their items removed, and none may be added.
#
#------------------------------------------------------------------------------
# Compatability:
@IMP1
IMP1 / corona_cases.py
Created March 30, 2020 22:14
Graphs!
#type in the command window
#conda install -c plotly plotly spyder
import pandas as pd
import plotly.graph_objects as go
import plotly.offline as pyo
import numpy
#import csv
# from datetime import datetime
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
file_extensions:
- conv
scope: source.conv
variables:
ident: '\b[\w]+\b'
label: ':{{ident}}'
type: '(?:str|int|bool)'
@IMP1
IMP1 / wry.rb
Created February 27, 2020 17:00
A ruby library for better golfing (maybe to be promoted to a ruby dialect?)
# wry
class Array
def indices(&block)
return self.map.with_index { |item, i| [item, i] }.select(&block).map { |item, i| i }
end
def map_with(n, &block)
if block.nil?
return self.each_slice(n)
else
@IMP1
IMP1 / cpu.rb
Created February 27, 2020 16:49
A ruby implementation of the DCPU16 cpu
# https://github.com/lucaspiller/dcpu-specifications/blob/master/dcpu16.txt
# https://gist.github.com/jonpovey/2608343
# https://www.reddit.com/r/dcpu16/comments/t5wu5/behavior_of_int_a_relating_to_interrupt_queueing/
# http://www.dcpu-ide.com/
#
class Ram
def initialize(size)
@max_index = size - 1
@IMP1
IMP1 / example.rb
Last active February 27, 2020 11:23
A language based on only pointers on the stack.
class HeapObject
attr_accessor :value
attr_reader :type
def initialize(value, type)
@value = value
@type = type
end
def get_pointer
return $heap.get_pointer(self)
end
@IMP1
IMP1 / dice.rb
Last active February 27, 2020 09:39
A dice rolling app. It can give you dice roll results, or a distribution of the possible outcomes for a given dice roll.
class Roll
attr_reader :die_values
attr_reader :command
attr_reader :count
attr_reader :die_size
def initialize(n, d)
@count = n
@die_size = d
@IMP1
IMP1 / unit.lua
Last active December 19, 2019 16:20
A minimal mathematical unit library for lua
local unit = {}
unit.__index = unit
function unit.new(amount, ...)
local self = {}
setmetatable(self, unit)
self.amount = amount
self.dimens = {}
for _, dimen in pairs({...}) do
self.dimens[dimen] = 1
require 'net/http'
require 'json'
require 'ostruct'
class Mask
EMPTY_PATTERN = /[\s\.\_]/
attr_reader :width
attr_reader :height