Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Yoo msjyoo

View GitHub Profile
@msjyoo
msjyoo / test.js
Created Oct 6, 2019
Event loop no-op performance test scripts
View test.js
let y = 0;
async function sleep() {
await new Promise(resolve => {
setImmediate(() => {
y++;
resolve();
});
});
}
@msjyoo
msjyoo / gravity.prg
Created Nov 18, 2018
Commodore 64 Game Code
View gravity.prg
10 rem reserve addresses above 13312
20 poke 55,0: poke 56,52: clr
30 gosub 1000
40 gosub 2000
50 gosub 3000
60 gosub 4000
70 gosub 5000
80 print "you win!"
500 end
@msjyoo
msjyoo / 75-input.rules
Created Apr 11, 2018 — forked from fghaas/75-input.rules
Attempt to disable AlpsPS/2 ALPS DualPoint Stick as an input device (via udev)
View 75-input.rules
# /etc/udev/rules.d/75-input.rules
# local udev rules for input devices
ACTION!="add|change", GOTO="input_end"
# ALPS DualPoint Stick: Ignore as input device
ENV{ID_BUS}=="i8042", ENV{NAME}=="AlpsPS/2 ALPS DualPoint Stick", ENV{ID_INPUT}="", ENV{ID_INPUT_MOUSE}="", ENV{ID_INPUT_POINTINGSTICK}=""
LABEL="input_end"
View Setting up Steam In-Home streaming in a network with port protection.md

If you have a gaming machine and a laptop, and want to use steam in-home streaming, but you only have 1 internet port in your room, and you only have a switch at your disposal? And it turns out just switching everything together doesn't work because your 1 port has port security enabled?

VLAN can be used to make sure that the port-security port doesn't see the computer while still all connected to the same switch.

1 - College LAN 2 - Laptop 3 - Gaming computer

Set up a VLAN between 1,2 and 2(tagged),3(PVID set to this VLAN). Pretty standard.

View comp2521-lab02-test.sh
#!/usr/bin/env bash
# Copyright (c) 2017 Michael Yoo <michael@yoo.id.au> All Rights Reserved, Licenced under Apache-2.0
set -u
CASES=( 5000 10000 20000 50000 )
RUN=5
TESTDIR=$(mktemp -d)
View firefox-build.dockerfile
FROM debian:jessie
ADD sources.list /etc/apt/sources.list
RUN cat /etc/apt/sources.list | sed -e 's/^deb/deb-src/g' >> /etc/apt/sources.list
WORKDIR /tmp/firefox-gtk2-build/
RUN apt-get update && apt-get build-dep -y -t unstable firefox=50.1.0-1
View Mystery bridge on linux
br-xxxxxxxxx
Could be docker, see using `docker network ls`
@msjyoo
msjyoo / clown_emoji.php
Created Feb 15, 2017
Example code for displaying Emojis with slices.
View clown_emoji.php
<?php
$body = "@ummjackson 🤡 https://i.imgur.com/I32CQ81.jpg";
/////////000000000011111111112222222222333333333344444
/////////012345678901234567890123456789012345678901234
///////// ^ ^
///////// ^ represented in single 'index-unit'
$urlStart = 14; // Inclusive
$urlEnd = 45; // Exclusive (end - start = length)
View Counting Clown Emojis.php
<?php
// Clown Emoji
// "🤡".length = 2 in Javascript (Firefox)
// '🤡abc'.length = 5 in Javascript (Firefox)
// . = Byte, () = Surrogate pairs
$x = '🤡'; // 4 bytes (UTF-8 (....))
$y = '🤡abc'; // 4 + 3 = 7 bytes (UTF-8 (....) . . .)
View test.php
<?php
/**
* Mimics the behaviour of javascript's charCodeAt.
*
* @param string $x
* @param int $index
*
* @return int
*/