Skip to content

Instantly share code, notes, and snippets.

View dreamalligator's full-sized avatar
🐊

Tom dreamalligator

🐊
View GitHub Profile
@psobot
psobot / kos_file_dumper.py
Last active June 13, 2023 16:27
Kurzweil KOS File Packer/Unpacker
"""
Kurzweil K2500/K2600 KOS operating system update file packer/repacker
by Peter Sobot, Nov 6, 2021
@psobot / github@petersobot.com
Requirements: none! Pure Python. Just use Python 3.2+.
"""
import os
import math
def print_result(desc)
result = yield
puts "#{desc} class=#{result.class} inspect=#{result.inspect}"
rescue => e
warn "#{desc} fail: #{e}"
end
def test(obj)
puts "\n== #{obj.inspect} == "
@lbrito1
lbrito1 / rspec_finder.sh
Created February 19, 2019 19:42
RSpec failing seed finder
#!/bin/bash
# Finds the first seed that breaks the spec suite. Outputs to stdout and a file (rspec_output).
found=0
while [ $found == 0 ]
do
rspec --order random 2>&1 | tee -a ./rspec_output
found=$(more rspec_output | grep Failed | wc -l)
if [ $found == 0 ]
@ixti
ixti / shellcheck-wrapper
Last active October 25, 2018 22:15
Simple shellcheck wrapper
#!/bin/bash
files=()
args=()
hashbang_regexp="^#\\!(/bin/|/usr/bin/env )?(sh|tcsh|csh|dash|bash)"
function lookup() {
while IFS= read -d $'\0' -r file; do
if [[ "${file}" =~ ^.*\.(ba|c|da|tc|z)?sh$ ]] \
|| head "${file}" -n 1 | grep -E -q "${hashbang_regexp}"; then
module AutocorrectThruDisableCuzWeSuckAtWritingGoodCode
def autocorrect(node)
->(corrector) do
until autocorrect_on.include? node&.type
node = node&.parent
return unless node
end
lines = node.source.lines
match = lines[0].match(/^(.*?)\s*((?<!\\)#(.*))?$/)
#!/usr/bin/env bash -x
# Creates RAM disk.
#
# SYNOPSIS
# create_ramdisk [size [label]]
#
# OPTIONS
# size: RAM disk size in megabytes. Default: 1024
# label: RAM disk volume label. Default: UUID
# I ran cloc (https://github.com/AlDanial/cloc) on each directory of mal (https://github.com/kanaka/mal)
# These are the results:
----------------------------------------------------------------------
dir-name top-language files blank comment code
----------------------------------------------------------------------
objpascal Pascal 19 706 951 6275
ada Ada 28 1984 380 5892
elm Elm 19 1625 226 5682
swift Swift 20 980 1519 5636
@Rich-Harris
Rich-Harris / README.md
Last active January 25, 2023 19:03
Unifying Rollup options

Rollup 0.48 introduces a few changes to the options object, because the current options are confusingly different between the CLI and the options exported by your config file.

Changes to the config file

  • entry is now input
  • sourceMap and sourceMapFile are now sourcemap and sourcemapFile (note casing)
  • moduleName is now name
  • useStrict is now strict

The dest and format options are now grouped together as a single output: { file, format, ... } object. output can also be an array of { file, format, ... } objects, in which case it behaves similarly to the current targets. Other output options — exports, paths and so on — can be added to the output object (though they will fall back to their top-level namesakes, if unspecified).

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 24, 2024 05:17
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@kchristidis
kchristidis / protobuf-serialization.md
Last active April 12, 2024 20:09
Notes on protocol buffers and deterministic serialization (or lack thereof)

There doesn't seem to be a good resource online describing the issues with protocol buffers and deterministic serialization (or lack thereof). This is a collection of links on the subject.

Protocol Buffers v3.0.0. release notes:

The deterministic serialization is, however, NOT canonical across languages; it is also unstable across different builds with schema changes due to unknown fields.

Maps documentation:

Wire format ordering and map iteration ordering of map values is undefined, so you cannot rely on your map items being in a particular order.