Skip to content

Instantly share code, notes, and snippets.

View msjyoo's full-sized avatar

Michael Yoo msjyoo

View GitHub Profile
# https://sanctum.geek.nz/arabesque/better-bash-history/
shopt -s histappend
shopt -s cmdhist
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT='%F %T '
export HISTFILE=~/.bash_history2
export HISTCONTROL=ignoreboth
export HISTIGNORE='ls:bg:fg:history'
export PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
@msjyoo
msjyoo / test.js
Created October 6, 2019 17:41
Event loop no-op performance test scripts
let y = 0;
async function sleep() {
await new Promise(resolve => {
setImmediate(() => {
y++;
resolve();
});
});
}
@msjyoo
msjyoo / gravity.prg
Created November 18, 2018 04:03
Commodore 64 Game Code
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 April 11, 2018 01:40 — forked from fghaas/75-input.rules
Attempt to disable AlpsPS/2 ALPS DualPoint Stick as an input device (via udev)
# /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"

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.

#!/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)
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
br-xxxxxxxxx
Could be docker, see using `docker network ls`
@msjyoo
msjyoo / clown_emoji.php
Created February 15, 2017 18:56
Example code for displaying Emojis with slices.
<?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)
<?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 (....) . . .)