Skip to content

Instantly share code, notes, and snippets.

View o0101's full-sized avatar
🏖️
Netscaping

Cris o0101

🏖️
Netscaping
View GitHub Profile
@o0101
o0101 / win98.html
Created January 24, 2023 16:19 — forked from camthesaxman/win98.html
Windows 98 Simulator
<html>
<head>
<title>Windows 98</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://unpkg.com/98.css">
<style>
/* Disable image filtering */
img {
image-rendering: optimizeSpeed; /* STOP SMOOTHING, GIVE ME SPEED */
@o0101
o0101 / web_htop.sh
Created January 3, 2023 04:23 — forked from stefanocudini/web_htop.sh
web colored interface for htop
#!/bin/bash
# requirements: apt install nmap htop aha
# (aha is ANSI color to HTML converter)
ncat -k -l -p 9999 -c "echo 'HTTP/1.1 200 OK\nContent-type: text/html\nconnection: close\\n'; echo q | htop | aha --black --line-fix"
@o0101
o0101 / LICENSE.md
Created December 30, 2022 10:01 — forked from sj26/LICENSE.md
Bash retry function

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit

@o0101
o0101 / typeclass-poc.js
Last active March 24, 2022 15:22
Very simple JavaScript type signatures and checking with pseudo-decorator syntax using tagged-template literals and computed property names
const Table = {};
let Id = 0;
class TypeClass {
constructor() {
const funcs = Object.getOwnPropertyNames(this.__proto__);
for( const funcName of funcs ) {
if (typeof this[funcName] === 'function' ) {
const typeSignature = Table[funcName];
@o0101
o0101 / proxy-wss.js
Last active March 1, 2022 03:32
Simple proxy for a Websocket endpoint
// requires
// npm i --save express cookie-parser ws
// node built-in imports
import fs from 'fs';
import os from 'os';
import path from 'path';
import https from 'https';
import crypto from 'crypto';
// 3rd-party NPM imports
@o0101
o0101 / tinysegmenter_japanese.js
Created January 2, 2022 18:38
TinySegmenter
// TinySegmenter 0.1 -- Super compact Japanese tokenizer in Javascript
// (c) 2008 Taku Kudo <[email protected]>
// TinySegmenter is freely distributable under the terms of a new BSD licence.
// For details, see http://chasen.org/~taku/software/TinySegmenter/LICENCE.txt
function TinySegmenter() {
var patterns = {
"[一二三四五六七八九十百千万億兆]":"M",
"[一-é¾ ã€…ã€†ãƒµãƒ¶]":"H",
"[ぁ-ん]":"I",
@o0101
o0101 / chrome_bookmark_checksum.py
Created January 2, 2022 16:21 — forked from simon816/chrome_bookmark_checksum.py
Calculate Chrome bookmarks checksum
from hashlib import md5
# See https://chromium.googlesource.com/chromium/src/+/master/components/bookmarks/browser/bookmark_codec.cc
def regen_checksum(roots):
digest = md5()
def digest_url(url):
digest.update(url['id'].encode('ascii'))
digest.update(url['name'].encode('UTF-16-LE'))
@o0101
o0101 / export-sync-bookmarks.js
Created December 29, 2021 15:13 — forked from ilokhov/export-sync-bookmarks.js
Node.js script for exporting and synchronising bookmarks from Google Chrome
const fs = require("fs");
const path = require("path");
function newItem(name, url) {
return { name, url };
}
const bookmarkPath = path.join(
process.env.HOME,
"/Library/Application Support/Google/Chrome/Default/Bookmarks"
@o0101
o0101 / enum.js
Created October 3, 2021 17:15
Enums in JavaScript
class Enum extends Function {
static opts = { enumerable: true, writeable: true, configurable: false };
constructor() {
super();
const names = (this.constructor+'').split('{')[1].split('}')[0].split(';').map(n => n.trim()).filter(n => n);
names.forEach((name, i) => {
Object.defineProperty(this.constructor, name.slice(1), { get: () => i, set: () => true, ...Enum.opts });
});
return this.constructor;
}
@o0101
o0101 / on_testing.md
Created September 30, 2021 13:05
My testing philosophy

On testing

  • fast feedback loop
  • set up your code so you can see it working. e.g dev server, CI/CD
  • code with imagination
    • (you're constantly thinking of edge caes naturally and places where things can go wrong, and coding defensively, or at least with awareness)
  • dogfooding, test by using
  • think of it as a product, test it from the user interaction