Skip to content

Instantly share code, notes, and snippets.

View telamon's full-sized avatar
🥲
probing for lost signals

Tony Ivanov telamon

🥲
probing for lost signals
View GitHub Profile
# API Design
PUT /$/bee/index
^ ^ ^^^^^ <-- hyperbee namespace
| |---- hyperbee special-path
|---- SPECIAL META charactter for hyper-fetch.
[
{ OPERATION1 },
{ OPERATION2 },

For a custom encoding using URL fragment-safe characters, you can go beyond Base64.
Considering alphanumeric characters (A-Z, a-z, 0-9), which give you 62 characters,
and adding safe special characters like:

-_.~!$&'()*+,;=:@?/#[]

(which are 22 in total), you can potentially reach a base count of around 84 (62 + 22).

This would be a custom base-84 encoding, utilizing these URL-safe characters to maximize space efficiency.

@telamon
telamon / tensor_cheatsheet.md
Created October 5, 2023 22:13
beginner pytorch tensor-cheatsheet.

Pytorch Tensor Cheatsheet

1. Initialization

  • Scalar (0D tensor):
    x = torch.tensor(42)
    # Shape: []
@telamon
telamon / sharescreen.sh
Last active October 2, 2023 02:45
Wayland screenshare script via wf-recorder and v4l2loopback
#!/bin/bash
# Preliminary steps (void linux):
# sudo xbps-install -Su v4l2loopback wf-recorder
# (don't forget to reboot if new Kernel version was upgraded)
#
# Too lazy to autodetect active monitor resolution
WIDTH=2560
HEIGHT=1440
@telamon
telamon / telnet.js
Created February 4, 2012 23:13
Telnet client in node
var net = require('net');
var client = net.connect(parseInt(process.argv[3]),process.argv[2],function(){
client.setEncoding('utf8');
console.log('Connected!!');
client.on('data',function(chunk){
console.log(chunk);
});
process.stdin.resume(); // Activate STDIN
process.stdin.setEncoding('utf8'); // Set it to string encoding
process.stdin.on('data',function(chunk){ // Pipe STDIN to Socket.out
@telamon
telamon / emojisearch.js
Created October 9, 2022 20:19
Emoji search-n-type picker
import { readFileSync } from 'node:fs'
import { pack, unpack } from 'msgpackr'
// Load tag->emo list
let a
try {
a = JSON.parse(readFileSync('./emojis.json'))
} catch (err) {
console.error(err.message)
console.log('do you have the input file?')
@telamon
telamon / rdhcpd.rb
Created May 20, 2011 23:58
Pure ruby DHCP server
' Copyright (c) 2007, Tony Ivanov
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
@telamon
telamon / example.txt
Created March 4, 2012 13:21
Minified Sha256 implementation in javascript from: http://www.movable-type.co.uk/scripts/sha256.html
Taken from: http://www.movable-type.co.uk/scripts/sha256.html
Put into: http://closure-compiler.appspot.com/home
exports:
/**
* Generates SHA-256 hash of string
*
* @param {String} msg String to be hashed
* @param {Boolean} [utf8encode=true] Encode msg as UTF-8 before generating hash
@telamon
telamon / socksproxy.js
Created August 5, 2011 12:42
Socks5 proxy implementation in Node.JS
// http://www.ietf.org/rfc/rfc1928.txt
// Tested with: curl http://www.google.se/ --socks5 1080 --proxy-user foo:bar
var States = {
CONNECTED:0,
VERIFYING:1,
READY:2,
PROXY: 3
};
@telamon
telamon / ArduinoExample.pde
Created October 10, 2011 23:32
Arduino+Processing Oscilloscope
#include "oscilloscope.h"
#define ANALOG_IN 0
void setup() {
Serial.begin(9600);
}
void loop() {
int val = analogRead(ANALOG_IN);