Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View taniarascia's full-sized avatar
💾

Tania Rascia taniarascia

💾
View GitHub Profile
@taniarascia
taniarascia / useful.sh
Last active February 13, 2024 07:49
Useful random stuff
# open all files named package.json within a directory
find . -name package.json -exec code {} +
# don't open or jump anywhere
<a href="#!">
# get an object from console
> store as a global variable
JSON.stringify(temp1)
@taniarascia
taniarascia / disassembly
Last active August 9, 2020 12:24
Disassembly
000000 121a JP 0x21a
000002 434f SNE V3, 0x4f
000004 4e4e SNE Ve, 0x4e
000006 4543 SNE V5, 0x43
000008 5434 DW 0x5434
00000a 2062 CALL 0x62
00000c 7920 ADD V9, 0x20
00000e 4461 SNE V4, 0x61
000010 7669 ADD V6, 0x69
000012 6420 LD V4, 0x20
@taniarascia
taniarascia / sort.js
Created January 2, 2019 20:43
Compare object of arrays by property include nulls and secondary property
function compareProperty(a, b) {
return a || b ? (!a ? 1 : !b ? -1 : a.localeCompare(b)) : 0
}
function myComparer(a, b) {
return compareProperty(a.jewelerName, b.jewelerName) || compareProperty(a.name, b.name)
}
// Flatten array
const flattened = [].concat.apply([], tableAssignmentsLookup)
@taniarascia
taniarascia / INSTRUCTION_SET.js
Last active February 13, 2024 07:49
Instruction Set
// 0nnn - SYS addr
// 00E0 - CLS
// 00EE - RET
// 1nnn - JP addr
// 2nnn - CALL addr
// 3xkk - SE Vx, byte
const INSTRUCTION_SET = [
{
name: 'SYS',
@taniarascia
taniarascia / RomBuffer.js
Last active February 13, 2024 07:49
RomBuffer.js
class RomBuffer {
constructor(filename) {
// 16-bit big endian values
this.data = []
let buffer = fs.readFileSync(filename)
if (buffer.length % 2 !== 0) throw new Error('Epic ROM Fail')
for (let i = 0; i < buffer.length; i += 2) {
this.data.push((buffer[i] << 8) | (buffer[i + 1] << 0))
@taniarascia
taniarascia / hex16.js
Last active February 13, 2024 07:49
hex16.js
// echo -en "\x01\x02\x03\x04\x05\x06hello world\x07\x08\x09\x10goodbye world\x11\x12\x13\x14\x15" > data
let fs = require('fs')
let file = process.argv.slice(2)[0]
function hexdump(file) {
let buffer = fs.readFileSync(file)
let lines = []
for (let i = 0; i < buffer.length; i += 16) {
@taniarascia
taniarascia / 16.js
Created January 1, 2019 00:57
16-bit
// echo -en "\x01\x02\x03\x04\x05\x06hello world\x07\x08\x09\x10goodbye world\x11\x12\x13\x14\x15" > data
let fs = require('fs')
let file = process.argv.slice(2)[0]
let buffer = fs.readFileSync(file)
let lines = []
for (let i = 0; i < buffer.length; i += 16) {
let block = buffer.slice(i, i + 16)
@taniarascia
taniarascia / hexdump.js
Last active February 13, 2024 07:49
Hex dump in JavaScript (Node.js)
const fs = require('fs')
const filename = process.argv.slice(2)[0]
function hexdump(filename) {
let buffer = fs.readFileSync(filename)
let lines = []
for (let i = 0; i < buffer.length; i += 16) {
let address = i.toString(16).padStart(8, '0') // address
let block = buffer.slice(i, i + 16) // cut buffer into blocks of 16
@taniarascia
taniarascia / read.js
Last active February 13, 2024 07:49
Read data
// echo -en "\x01\x02\x03hello" > data
// node read.js data
let fs = require('fs')
let file = process.argv.slice(2)[0]
let buffer = fs.readFileSync(file)
for (let value of buffer) {
let decimal = value
let hex = value.toString(16)
@taniarascia
taniarascia / keybase.md
Created December 22, 2018 21:24
Keybase

Keybase proof

I hereby claim:

  • I am taniarascia on github.
  • I am taniarascia (https://keybase.io/taniarascia) on keybase.
  • I have a public key whose fingerprint is 2389 41F6 BA1D 7BE2 119E 973D 8345 A0A6 86E5 7E04

To claim this, I am signing this object: